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

Fixed crash on uncaught "Invalid image data" exception #1648

Merged
merged 2 commits into from
Sep 10, 2023

Conversation

s6o
Copy link
Contributor

@s6o s6o commented Sep 10, 2023

When running a custom tile server, in the case of a missing tile we can get back zero bytes. Resulting in the decode function failure in _loadAsync of FlutterMapNetworkImageProvider.

Looking at the _loadAsync implementation, the call to the decode function was left out of the try/catch block. Simply moving the decode function call inside the try block fixes the issue - the app no longer crashes on a missing tile.

…bytes (MacOS desktop).

When running a custom tile server, in the case of a missing tile we can get
back zero bytes. Resulting in the **decode** function failure in
**_loadAsync** of FlutterMapNetworkImageProvider.

Looking at the **_loadAsync** implementation, the call to the **decode**
function was left out of the try/catch block. Simply moving the
**decode** function call inside the try block fixes the issue - the app
no longer crashes on a missing tile.
@JaffaKetchup
Copy link
Member

Hey @s6o, thanks for this! Would it be possible for you also to create a bug report?

@s6o
Copy link
Contributor Author

s6o commented Sep 10, 2023

Screenshot 2023-09-10 at 11 41 59

JaffaKetchup added a commit to fleaflet/flutter_map_cancellable_tile_provider that referenced this pull request Sep 10, 2023
@s6o
Copy link
Contributor Author

s6o commented Sep 10, 2023

Hey @s6o, thanks for this! Would it be possible for you also to create a bug report?

Hey, I've done so: Bug report

@JaffaKetchup JaffaKetchup linked an issue Sep 10, 2023 that may be closed by this pull request
@JaffaKetchup JaffaKetchup changed the title Fix crash on uncaught "Invalid image data" exception (MacOS desktop) Fixed crash on uncaught "Invalid image data" exception Sep 10, 2023
Copy link
Member

@JaffaKetchup JaffaKetchup left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing this!

@JaffaKetchup JaffaKetchup merged commit 06f75f0 into fleaflet:master Sep 10, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on uncaught "Invalid image data" exception
2 participants