Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to invoke virtual method 'void org.maplibre.android.location.LocationComponent.setMaxAnimationFps(int)' on a null object reference #439

Closed
RobertSasak opened this issue Sep 10, 2024 · 2 comments · Fixed by #440

Comments

@RobertSasak
Copy link
Contributor

Steps to Trigger Behavior

As this is issue is connected to recent #428 I hope it is OK to omit all issue details. Let me know if more information is needed.

  1. Disable location permissions for the app
  2. Run SetAndroidPreferredFramesPerSecond.tsx demo
  3. App crash

Link to Minimal Reproducible Example

https://github.com/maplibre/maplibre-react-native/blob/main/example/src/examples/UserLocation/SetAndroidPreferredFramesPerSecond.tsx

Expected Behavior

App should not crash.

Actual Behavior

FATAL EXCEPTION: main
	java.lang.NullPointerException: Attempt to invoke virtual method 'void org.maplibre.android.location.LocationComponent.setMaxAnimationFps(int)' on a null object reference
		at com.maplibre.rctmln.components.location.LocationComponentManager.setPreferredFramesPerSecond(LocationComponentManager.java:75)
		at com.maplibre.rctmln.components.location.RCTMLNNativeUserLocation.setPreferredFramesPerSecond(RCTMLNNativeUserLocation.java:73)
		at com.maplibre.rctmln.components.location.RCTMLNNativeUserLocation.addToMap(RCTMLNNativeUserLocation.java:32)
		at com.maplibre.rctmln.components.mapview.RCTMLNMapView.addQueuedFeatures(RCTMLNMapView.java:567)
		at com.maplibre.rctmln.components.mapview.RCTMLNMapView$1.onStyleLoaded(RCTMLNMapView.java:457)
		at org.maplibre.android.maps.MapLibreMap.getStyle(MapLibreMap.java:125)
		at com.maplibre.rctmln.components.mapview.RCTMLNMapView.onMapReady(RCTMLNMapView.java:452)
		at org.maplibre.android.maps.MapView$MapCallback.onMapReady(MapView.java:1324)
		at org.maplibre.android.maps.MapView$MapCallback.initialised(MapView.java:1310)
		at org.maplibre.android.maps.MapView.initialiseMap(MapView.java:203)
		at org.maplibre.android.maps.MapView.access$800(MapView.java:65)
		at org.maplibre.android.maps.MapView$6.run(MapView.java:357)
		at android.os.Handler.handleCallback(Handler.java:958)
		at android.os.Handler.dispatchMessage(Handler.java:99)
		at android.os.Looper.loopOnce(Looper.java:205)
		at android.os.Looper.loop(Looper.java:294)
		at android.app.ActivityThread.main(ActivityThread.java:8177)
		at java.lang.reflect.Method.invoke(Native Method)
		at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
		at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Screenshots (if applicable)

Version(s) affected

  • Platform: Android
  • OS version: Android 14
  • Device type: Pixel 7 Pro
  • Emulator/ Simulator: yes
  • maplibre-react-native Version 10.0.0-alpha.12

Additional context

In #428 @marekmeissner introduced great new feature to set max animation FPS. However this crash app when there is no location permissions given to app. Quick look into code suggest that a null check might prevent this issue. As this is a fresh PR perhaps Marek can suggest a fix.

@marekmeissner
Copy link
Contributor

Thank you for spotting it, I can look into it

Copy link

github-actions bot commented Dec 2, 2024

🎉 This issue has been resolved in version 10.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants