diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 9d497691d8..586e00b5e4 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -550,7 +550,16 @@ attributedStringInfo getSegments(NSAttributedString *str) if (mModifiers & mask) { eventData.mKeyEvent = NativeKeyEventData::KEYDOWN; - callKeyDown(&eventData, [theEvent keyCode], 0, [[theEvent characters] characterAtIndex:0]); + + wchar_t c = 0; + if([theEvent type] == NSEventTypeKeyDown) + { + // characters property is only valid when the event is of type KeyDown or KeyUp + // https://developer.apple.com/documentation/appkit/nsevent/1534183-characters?language=objc + c = [[theEvent characters] characterAtIndex:0]; + } + + callKeyDown(&eventData, [theEvent keyCode], 0, c); } else { |