aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-10-16 09:01:33 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2014-10-16 09:01:33 -0700
commit21e4e5812bd807a0408dfe58652e94005281672f (patch)
treed292c5a1de0e5f7814fc11874fa86248ade190d3 /src
parent96ecb12484e798437010d6015b20ac9e0f0a090f (diff)
Fixed crash when lastPathComponent() is called on an empty string (#911)
Diffstat (limited to 'src')
-rw-r--r--src/core/basetypes/MCString.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/basetypes/MCString.cc b/src/core/basetypes/MCString.cc
index 0960da7a..bcc1ec9d 100644
--- a/src/core/basetypes/MCString.cc
+++ b/src/core/basetypes/MCString.cc
@@ -1860,6 +1860,8 @@ bool String::hasPrefix(String * prefix)
String * String::lastPathComponent()
{
// TODO: Improve Windows compatibility.
+ if (mUnicodeChars == NULL)
+ return MCSTR("");
UChar * component = u_strrchr(mUnicodeChars, '/');
if (component == NULL)
return (String *) this->copy()->autorelease();