aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp
index dae0a0d699..bc0c658c57 100644
--- a/engines/wintermute/base/scriptables/script_ext_string.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_string.cpp
@@ -298,7 +298,9 @@ bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
uint32 start = 0;
for(uint32 i = 0; i < str.size() + 1; i++) {
- uint32 ch = str[i];
+ // The [] operator doesn't allow access to the zero code terminator
+ // (bug #6531)
+ uint32 ch = (i == str.size()) ? '\0' : str[i];
if (ch =='\0' || delims.contains(ch)) {
if (i != start) {
parts.push_back(WideString(str.c_str() + start, i - start + 1));