aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/teenagent/surface_list.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/teenagent/surface_list.cpp b/engines/teenagent/surface_list.cpp
index 2f426d14f8..9157667ba4 100644
--- a/engines/teenagent/surface_list.cpp
+++ b/engines/teenagent/surface_list.cpp
@@ -33,12 +33,15 @@ void SurfaceList::load(Common::SeekableReadStream *stream, Type type, int sub_ha
free();
byte fn = stream->readByte();
- if (stream->eos() || fn == 0)
+ if (stream->eos())
return;
debug(0, "loading %u surfaces from list (skip %d)", fn, sub_hack);
surfaces_n = fn - sub_hack;
+ if (surfaces_n == 0)
+ return;
+
surfaces = new Surface[surfaces_n];
byte i;