aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/detection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agi/detection.cpp')
-rw-r--r--engines/agi/detection.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index e26f5c84fc..817be08f2c 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -375,7 +375,11 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl
char saveVersion = in->readByte();
if (saveVersion >= 4) {
- Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*in);
+ Graphics::Surface *thumbnail;
+ if (!Graphics::loadThumbnail(*in, thumbnail)) {
+ delete in;
+ return SaveStateDescriptor();
+ }
descriptor.setThumbnail(thumbnail);