diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-10-27 09:54:54 -0700 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-10-27 09:54:54 -0700 |
commit | 2e430a12779ee959cdc6ed92cffd7a03e5a52e61 (patch) | |
tree | c23c7b5f79170a4d76fa5c6b550d7ce6ea1e6751 /src/core | |
parent | 225e5879a3c35d11fe1b9df2a2d15a1a13ee65ce (diff) |
Fixed crash (#938)
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/basetypes/MCString.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/basetypes/MCString.cc b/src/core/basetypes/MCString.cc index 581bd245..c005ceb1 100644 --- a/src/core/basetypes/MCString.cc +++ b/src/core/basetypes/MCString.cc @@ -962,6 +962,10 @@ void String::appendUTF8CharactersLength(const char * UTF8Characters, unsigned in #if DISABLE_ICU CFStringRef cfStr = CFStringCreateWithBytes(NULL, (const UInt8 *) UTF8Characters, length, kCFStringEncodingUTF8, false); + if (cfStr == NULL) { + // Data could not be converted to UTF-8. + return; + } UniChar * characters = (UniChar *) malloc(sizeof(* characters) * CFStringGetLength(cfStr)); CFStringGetCharacters(cfStr, CFRangeMake(0, CFStringGetLength(cfStr)), characters); appendCharactersLength(characters, (unsigned int) CFStringGetLength(cfStr)); |