aboutsummaryrefslogtreecommitdiffhomepage
path: root/macosx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2010-03-29 03:52:24 +0000
committernyamatongwe <unknown>2010-03-29 03:52:24 +0000
commit3d29f85c78c10b46b0b3c39e36bb1e7b1aa1333f (patch)
treeb7517d43f56f621a6148a4d81e5ac8236c6cb6eb /macosx
parent6bbc68fb3e49963433e710161b218c3af37cf5b4 (diff)
downloadscintilla-mirror-3d29f85c78c10b46b0b3c39e36bb1e7b1aa1333f.tar.gz
Ensure does not crash if NULL handle.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/ScintillaMacOSX.cxx31
1 files changed, 17 insertions, 14 deletions
diff --git a/macosx/ScintillaMacOSX.cxx b/macosx/ScintillaMacOSX.cxx
index 1ff26a2b7..2abef78c7 100644
--- a/macosx/ScintillaMacOSX.cxx
+++ b/macosx/ScintillaMacOSX.cxx
@@ -1830,20 +1830,23 @@ static inline UniChar GetCharacterWithoutModifiers( EventRef rawKeyboardEvent )
SInt16 lastKeyLayoutID = GetScriptVariable( /*currentKeyScript*/ GetScriptManagerVariable(smKeyScript), smScriptKeys);
Handle uchrHandle = GetResource('uchr', lastKeyLayoutID);
- // Translate the key press ignoring ctrl and option
- UInt32 ignoredDeadKeys = 0;
- UInt32 ignoredActualLength = 0;
- UniChar unicodeKey = 0;
- // (((modifiers & shiftKey) >> 8) & 0xFF)
- OSStatus err;
- err = UCKeyTranslate( reinterpret_cast<UCKeyboardLayout*>( *uchrHandle ), keyCode, kUCKeyActionDown,
- /* modifierKeyState */ 0, LMGetKbdType(), kUCKeyTranslateNoDeadKeysMask, &ignoredDeadKeys,
- /* buffer length */ 1,
- /* actual length */ &ignoredActualLength,
- /* string */ &unicodeKey );
- assert( err == noErr );
-
- return unicodeKey;
+ if (uchrHandle) {
+ // Translate the key press ignoring ctrl and option
+ UInt32 ignoredDeadKeys = 0;
+ UInt32 ignoredActualLength = 0;
+ UniChar unicodeKey = 0;
+ // (((modifiers & shiftKey) >> 8) & 0xFF)
+ OSStatus err;
+ err = UCKeyTranslate( reinterpret_cast<UCKeyboardLayout*>( *uchrHandle ), keyCode, kUCKeyActionDown,
+ /* modifierKeyState */ 0, LMGetKbdType(), kUCKeyTranslateNoDeadKeysMask, &ignoredDeadKeys,
+ /* buffer length */ 1,
+ /* actual length */ &ignoredActualLength,
+ /* string */ &unicodeKey );
+ assert( err == noErr );
+
+ return unicodeKey;
+ }
+ return 0;
}
// Text input is very annoying: