Fix infoPanel crashes when loading incompatible images, that also need to be stretched #1418
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1386
The images that crashed the infoPanel were in a different format, which SDL_SoftStretch couldn't handle, leaving image_to_draw empty and subsequently crashing when drawing the empty image.
To safeguard against this, create a separate surface and check the return of SoftStretch for error.
Testing this showed that some of the stretched images looked horrible, so now only stretch images if they are too big to fit the screen. (MMv4 752x560 screenshots mainly)
Additionally, add some error handling to the Gallery launch script, so it would show "Error" instead of "No screenshots found" when infoPanel crashes to be less misleading.
To test, copy the screenshot folder from the issue #1386 to your SD/Screenshots and confirm it doesn't crash when loading the different screenshots.