-
Notifications
You must be signed in to change notification settings - Fork 171
Added checks if style is fully loaded before accessing it #563
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
Added checks if style is fully loaded before accessing it #563
Conversation
|
@albertmoravec Can you describe these "certain situations"? Maybe I can reproduce them on iOS. |
Ah, I did not have much time to check myself, but generally you can break a lot of things by changing map style (e.g. between normal and satellite map) and doing other stuff like clicking into the map while it is loading. At least that's how I triggered this on Android. The map tends to break a lot when you put all its features under stress when style is loading, since a lot of places are missing necessary checks and that breaks Flutter a bit more than for native apps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds null safety checks to prevent crashes on Android by ensuring the map style is fully loaded before accessing its layers. The changes address situations where style operations were attempted before the style finished loading.
- Added
style.isFullyLoaded()checks alongside existing null checks - Applied the fix to two methods that access style layers
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
maplibre_gl/android/src/main/java/org/maplibre/maplibregl/MapLibreMapController.java
Outdated
Show resolved
Hide resolved
|
Hi @albertmoravec, thanks for your efforts and contribution! Sorry for the late review |
Added missing checks which caused crashes in certain situations on Android.
This is probably an issue on iOS as well, but I don't have access to my Mac at the moment. I'll open a separate PR for iOS if I am able to confirm and fix this.