From 5d0ebad9968898377f65bd233332afadaf106b19 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 18 Feb 2014 10:50:06 +0200 Subject: [PATCH] WME: Fix bug #6531 - "WME: Art of Murder - Assertion" --- engines/wintermute/base/scriptables/script_ext_string.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp index dae0a0d699e9..bc0c658c570a 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));