From 899beb69199ba6363794975058b1d965c5989c71 Mon Sep 17 00:00:00 2001 From: crs23 Date: Thu, 6 Sep 2007 05:02:08 +0000 Subject: [PATCH] Applied patch from tailblues. It checks for a NULL result from CFStringCreate...() to avoid a crash in a subsequent use of that NULL pointer. --- lib/platform/COSXKeyState.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/platform/COSXKeyState.cpp b/lib/platform/COSXKeyState.cpp index ec6c68c9..2f94f283 100644 --- a/lib/platform/COSXKeyState.cpp +++ b/lib/platform/COSXKeyState.cpp @@ -793,6 +793,13 @@ COSXKeyState::CKeyResource::getKeyID(UInt8 c) str, GetScriptManagerVariable(smKeyScript), 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 CFMutableStringRef mcfString = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, cfString);