Skip to content

[Bug]: Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.getcapacitor.PluginCall.getCallbackId()' on a null object reference #87

Description

@tafelnl

Current Behavior

I've noticed the following crash happening in production:

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.getcapacitor.PluginCall.getCallbackId()' on a null object reference
at com.capacitorjs.plugins.geolocation.GeolocationPlugin$startWatch$1.invokeSuspend (GeolocationPlugin.kt)

Expected Behavior

Not crashing on null object reference

Reproduction

Hard to say as it's a bug reported by crashlytics. However it's pretty obvious from the code that it can happen:

Screenshots / Media

No response

Environment Details

Crashlytics

Versions Affected

v7.1.6, v8.2.0

Platforms Affected

  • iOS
  • Android
  • Web

Notes / Comments

It would probably be sufficient to add a check similar to if (call == null) { return }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions