aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agos/items.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 13034b74c9..b2e722d681 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -382,8 +382,13 @@ int AGOSEngine::wordMatch(Item *item, int16 a, int16 n) {
}
Item *AGOSEngine::derefItem(uint item) {
- if (item >= _itemArraySize)
- error("derefItem: invalid item %d", item);
+ // Occurs when loading item store from restart state in
+ // Elvira 2 (Amiga/AtariST) and Waxworks (Amiga).
+ if (item >= _itemArraySize) {
+ debug(0, "derefItem: invalid item %d", item);
+ return NULL;
+ }
+
return _itemArrayPtr[item];
}