[Scummvm-git-logs] scummvm master -> 4a5250c8680b6f944836014595f267fa481c1d20

dreammaster noreply at scummvm.org
Wed Apr 22 06:30:12 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
4a5250c868 MADS: PHANTOM: Fix crash entering Box 5


Commit: 4a5250c8680b6f944836014595f267fa481c1d20
    https://github.com/scummvm/scummvm/commit/4a5250c8680b6f944836014595f267fa481c1d20
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-22T16:30:03+10:00

Commit Message:
MADS: PHANTOM: Fix crash entering Box 5

Changed paths:
    engines/mads/madsv2/core/attr.cpp


diff --git a/engines/mads/madsv2/core/attr.cpp b/engines/mads/madsv2/core/attr.cpp
index cd9407381b2..a13e7af68c8 100644
--- a/engines/mads/madsv2/core/attr.cpp
+++ b/engines/mads/madsv2/core/attr.cpp
@@ -70,9 +70,15 @@ int attr_depth(TileMapHeader *depth_map, int x, int y) {
 	x = x - depth_map->pan_base_x;
 	y = y - depth_map->pan_base_y;
 
-	scan = buffer_pointer(depth_map->buffer, (x >> 1), y);
-	shift_count = (byte)((x & 1) ? 0 : 4);
-	depth_code = (byte)((*scan >> shift_count) & 0x0f);
+	// WORKAROUND: Fixes crash in ROTP entering Box 5
+	if (x < 0 || y < 0 || (x >> 1) >= depth_map->buffer->x ||
+			y >= depth_map->buffer->y) {
+		depth_code = 0;
+	} else {
+		scan = buffer_pointer(depth_map->buffer, (x >> 1), y);
+		shift_count = (byte)((x & 1) ? 0 : 4);
+		depth_code = (byte)((*scan >> shift_count) & 0x0f);
+	}
 
 	if (view_changed) {
 		tile_pan(depth_map, pan_to_x, pan_to_y);




More information about the Scummvm-git-logs mailing list