Skip to content

Commit

Permalink
GRAPHICS: Set thumbnail to nullptr when loading the thumbnail is skipped
Browse files Browse the repository at this point in the history
Since Graphics::loadThumbnail can return successfully when a thumbnail is skipped
the caller may want to check to the see that the thumbnail is not null before using
it. Setting it to null is just defensive in case the caller didn't do so.

If the user tries to use the thumbnail in setThumbnail then it will just
show a black screen for the thumbnail rather than crashing if they have
not set the thumbnail to null.
  • Loading branch information
dafioram authored and sev- committed Aug 3, 2018
1 parent 3922370 commit bafe22c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions graphics/thumbnail.cpp
Expand Up @@ -149,6 +149,7 @@ bool skipThumbnail(Common::SeekableReadStream &in) {

bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface *&thumbnail, bool skipThumbnail) {
if (skipThumbnail) {
thumbnail = nullptr;
return Graphics::skipThumbnail(in);
}

Expand Down

0 comments on commit bafe22c

Please sign in to comment.