aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-05-07 11:46:29 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-05-07 11:46:29 -0700
commit164c2f79bed8923c15a471e42bb72b4c1cf115d0 (patch)
treeded4719994a77edef91fd8c4cc79c9eb73ab4913
parentf1d109fa194d82ea25656c33f5aade3c19469ea8 (diff)
log when a weird situation happens in componentsSeparatedByString()
-rw-r--r--src/core/basetypes/MCString.cpp4
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);