diff options
-rw-r--r-- | src/core/basetypes/MCString.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/basetypes/MCString.cpp b/src/core/basetypes/MCString.cpp index 7581343e..aad82580 100644 --- a/src/core/basetypes/MCString.cpp +++ b/src/core/basetypes/MCString.cpp @@ -2396,6 +2396,10 @@ Array * String::componentsSeparatedByString(String * separator) p = location + separator->length(); } unsigned int length = (unsigned int) (mLength - (p - mUnicodeChars)); + if (length > mLength) { + fprintf(stderr, "trying to split string: |%s| |%s| %i %i %p %p\n", MCUTF8(this), MCUTF8(separator), length, mLength, p, mUnicodeChars); + return result; + } MCAssert(length <= mLength); String * value = new String(p, length); result->addObject(value); |