summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2023-06-15 14:39:05 -0700
committerBrad Linden <brad@lindenlab.com>2023-06-15 14:39:05 -0700
commitcb8c91ffc8e6c40dfd6cb86922ac3c6968855466 (patch)
tree85ef549fd5e9b4e889b855c45da91a52e42b11b5 /indra/llwindow
parent6f767db34992b04d67cb25bf976581aee4acac78 (diff)
SL-19881 fix assertion failure in [NSEvent characters]
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llopenglview-objc.mm11
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
{