Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Adding try/catch to SnapshotNotificationActivity to catch IllegalStateException #1236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

langsmith
Copy link
Contributor

Resolves #1136 by adding a try/catch to fix a crash. I was able to reproduce the crash by quickly tapping the map twice. The second tap throws the exception because the MapSnapshotter is already created and in the process of creating the snapshot.

The exception from MapSnapshotter.java is now printed to the logcat and a cleaner message is displayed in a Toast.

cc @JoelNieman

Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about we refactor the code a bit to avoid this issue? I would suggest introducing an inner class handling the click event and holding a reference to the style. This way we can avoid needing to call getStyle in the onMapClick event and we are sure we won't create two snapshots as the if check on mapSnapshotter will execute as expected

@langsmith langsmith force-pushed the ls-snapshotter-IllegalStateException-fix branch from adaefcf to 95e2d0d Compare October 2, 2019 21:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IllegalStateException
2 participants