aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/glk/advsys/game.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/glk/advsys/game.cpp b/engines/glk/advsys/game.cpp
index 3b6133d6ef..d051a352b6 100644
--- a/engines/glk/advsys/game.cpp
+++ b/engines/glk/advsys/game.cpp
@@ -250,12 +250,16 @@ int Game::getActionLocation(int action) const {
}
int Game::getVariable(int variableNum) {
- assert(variableNum < _variableCount);
+ if (variableNum < 1 || variableNum > _variableCount)
+ error("Invalid ariable number %d", variableNum);
+
return READ_LE_UINT16(_variableTable + variableNum * 2);
}
void Game::setVariable(int variableNum, int value) {
- assert(variableNum < _variableCount);
+ if (variableNum < 1 || variableNum > _variableCount)
+ error("Invalid ariable number %d", variableNum);
+
WRITE_LE_UINT16(_variableTable + variableNum * 2, value);
}