aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/nebular/nebular_scenes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mads/nebular/nebular_scenes.cpp')
-rw-r--r--engines/mads/nebular/nebular_scenes.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp
index c71512ed4c..b5e2491624 100644
--- a/engines/mads/nebular/nebular_scenes.cpp
+++ b/engines/mads/nebular/nebular_scenes.cpp
@@ -331,7 +331,7 @@ void SceneInfoNebular::loadCodes(MSurface &depthSurface, Common::SeekableReadStr
byte runValue = stream->readByte();
// Write out the run length
- Common::fill(destP, destP + runLength, runValue);
+ Common::fill(destP, MIN(endP, destP + runLength), runValue);
destP += runLength;
// Get the next run length