Applied patch from tailblues. It checks for a NULL result from

CFStringCreate...() to avoid a crash in a subsequent use of that
NULL pointer.
This commit is contained in:
crs23 2007-09-06 05:02:08 +00:00
parent 617b93b984
commit 899beb6919
1 changed files with 7 additions and 0 deletions

View File

@ -793,6 +793,13 @@ COSXKeyState::CKeyResource::getKeyID(UInt8 c)
str, GetScriptManagerVariable(smKeyScript), str, GetScriptManagerVariable(smKeyScript),
kCFAllocatorNull); kCFAllocatorNull);
// sometimes CFStringCreate...() returns NULL (e.g. Apple Korean
// encoding with char value 214). if it did then make no key,
// otherwise CFStringCreateMutableCopy() will crash.
if (cfString == NULL) {
return kKeyNone;
}
// convert to precomposed // convert to precomposed
CFMutableStringRef mcfString = CFMutableStringRef mcfString =
CFStringCreateMutableCopy(kCFAllocatorDefault, 0, cfString); CFStringCreateMutableCopy(kCFAllocatorDefault, 0, cfString);