Skip to content
New issue

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

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

Already on GitHub? # to your account

Crash on uncaught "Invalid image data" exception #1649

Closed
s6o opened this issue Sep 10, 2023 · 3 comments · Fixed by #1648
Closed

Crash on uncaught "Invalid image data" exception #1649

s6o opened this issue Sep 10, 2023 · 3 comments · Fixed by #1648
Labels
bug This issue reports broken functionality or another error P: 2 (soon™?)

Comments

@s6o
Copy link
Contributor

s6o commented Sep 10, 2023

What is the bug?

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.

How can we reproduce it?

Use a custom tile server that on a missing tile return zero bytes.

Do you have a potential solution?

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.

Platforms

MacOS Ventura 13.5.1 (M1)

Severity

Fatal: Causes the application to crash

@s6o s6o added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Sep 10, 2023
@JaffaKetchup JaffaKetchup added P: 2 (soon™?) and removed needs triage This new bug report needs reproducing and prioritizing labels Sep 10, 2023
@JaffaKetchup
Copy link
Member

Thanks for reporting this! I'm not sure that this would cause a fatal error, but yes, it is still an issue.

@JaffaKetchup JaffaKetchup linked a pull request Sep 10, 2023 that will close this issue
@JaffaKetchup JaffaKetchup changed the title Crash on uncaught "Invalid image data" exception on MacOS desktop. Crash on uncaught "Invalid image data" exception Sep 10, 2023
@s6o
Copy link
Contributor Author

s6o commented Sep 10, 2023

Thanks for reporting this! I'm not sure that this would cause a fatal error, but yes, it is still an issue.

Yes correct, in release mode it does not crash, but now less annoying in debug mode/development :-)

@JaffaKetchup
Copy link
Member

Sure. This also means fallbackUrl will now be attempted where the exception is thrown from decode instead of during the network request.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug This issue reports broken functionality or another error P: 2 (soon™?)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants