From 6ffe686ba884b0ed4e9ed7ef14b0790050c82f82 Mon Sep 17 00:00:00 2001 From: Sergey Petrenko Date: Wed, 22 Mar 2023 10:24:22 +0300 Subject: [PATCH] check keydown event characters length before returning the pressed character code --- modules/highgui/src/window_cocoa.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/highgui/src/window_cocoa.mm b/modules/highgui/src/window_cocoa.mm index 1cf55f9397..2c05b10be5 100644 --- a/modules/highgui/src/window_cocoa.mm +++ b/modules/highgui/src/window_cocoa.mm @@ -618,7 +618,7 @@ CV_IMPL int cvWaitKey (int maxWait) inMode:NSDefaultRunLoopMode dequeue:YES]; - if([event type] == NSKeyDown) { + if([event type] == NSKeyDown && [[event characters] length]) { returnCode = [[event characters] characterAtIndex:0]; break; }