aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/parallaction/commands.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/engines/parallaction/commands.cpp b/engines/parallaction/commands.cpp
index fada14c94e..44910b35aa 100644
--- a/engines/parallaction/commands.cpp
+++ b/engines/parallaction/commands.cpp
@@ -295,11 +295,19 @@ void runCommands(Command *list, Zone *z) {
break;
case CMD_ON: // on
- u->_zone->_flags &= ~kFlagsRemove;
- u->_zone->_flags |= kFlagsActive;
- if ((u->_zone->_type & 0xFFFF) == kZoneGet) {
- addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 );
- }
+ // WORKAROUND: the original DOS-based engine didn't check u->_zone before dereferencing
+ // the pointer to get structure members, thus leading to crashes in systems with memory
+ // protection.
+ // As a side note, the overwritten address is the 5th entry in the DOS interrupt table
+ // (print screen handler): this suggests that a system would hang when the print screen
+ // key is pressed after playing Nippon Safes, provided that this code path is taken.
+ if (u->_zone != NULL) {
+ u->_zone->_flags &= ~kFlagsRemove;
+ u->_zone->_flags |= kFlagsActive;
+ if ((u->_zone->_type & 0xFFFF) == kZoneGet) {
+ addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 );
+ }
+ }
break;
case CMD_OFF: // off