aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kstring.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 13ec1bfc88..69090c4335 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -151,9 +151,13 @@ reg_t kReadNumber(EngineState *s, int argc, reg_t *argv) {
source++;
}
while (*source) {
+ if ((*source < '0') || (*source > '9')) {
+ // TODO: this happens in lsl5 right in the intro -> we get '1' '3' 0xCD 0xCD 0xCD 0xCD 0xCD
+ // find out why this happens and fix it
+ warning("Invalid character in kReadNumber input");
+ break;
+ }
result *= 10;
- if ((*source < '0') || (*source > '9'))
- error("Invalid character in kReadNumber input");
result += *source - 0x30;
source++;
}