GRAPHICS: Set thumbnail to nullptr when loading the thumbnail is skipped

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.
This commit is contained in:
David Fioramonti 2018-07-25 18:07:20 -07:00 committed by Eugene Sandulenko
parent 3922370275
commit bafe22c782

View File

@ -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);
}