ionic-team / ionic-team/capacitor-geolocation
[Bug]: Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.getcapacitor.PluginCall.getCallbackId()' on a null object reference
- Dominant language
- Swift
- Stars
- 12
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
### 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: https://github.com/ionic-team/capacitor-geolocation/blob/1a2504a2b50f1793089bdbf029b010980d6dbcfa/android/src/main/kotlin/com/capacitorjs/plugins/geolocation/GeolocationPlugin.kt#L223
### Screenshots / Media
_No response_
### Environment Details
```Shell
Crashlytics
```
### Versions Affected
v7.1.6, v8.2.0
### Platforms Affected
- [ ] iOS
- [x] Android
- [ ] Web
### Notes / Comments
It would probably be sufficient to add a check similar to `if (call == null) { return }`
Contributor guide
Assessment
This issue has not been assessed yet.