aboutsummaryrefslogtreecommitdiff
path: root/graphics/thumbnail.cpp
diff options
context:
space:
mode:
authorDavid Fioramonti2018-07-25 18:07:20 -0700
committerEugene Sandulenko2018-08-03 14:51:12 +0200
commitbafe22c782909b6f92cc42cfbf82a65d1167dc29 (patch)
tree0b4796c9ab763e22fee14202bd4fc9fd6e0c0600 /graphics/thumbnail.cpp
parent3922370275a7141eebc3b3f12e24112c38fc4438 (diff)
downloadscummvm-rg350-bafe22c782909b6f92cc42cfbf82a65d1167dc29.tar.gz
scummvm-rg350-bafe22c782909b6f92cc42cfbf82a65d1167dc29.tar.bz2
scummvm-rg350-bafe22c782909b6f92cc42cfbf82a65d1167dc29.zip
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.
Diffstat (limited to 'graphics/thumbnail.cpp')
-rw-r--r--graphics/thumbnail.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp
index 72a06f91ec..c769591936 100644
--- a/graphics/thumbnail.cpp
+++ b/graphics/thumbnail.cpp
@@ -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);
}