diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-10-16 09:01:33 -0700 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-10-16 09:01:33 -0700 |
commit | 21e4e5812bd807a0408dfe58652e94005281672f (patch) | |
tree | d292c5a1de0e5f7814fc11874fa86248ade190d3 | |
parent | 96ecb12484e798437010d6015b20ac9e0f0a090f (diff) |
Fixed crash when lastPathComponent() is called on an empty string (#911)
-rw-r--r-- | src/core/basetypes/MCString.cc | 2 |
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(); |