Merge pull request #23390 from just-gull:bugfix.21401.fix-macos-crash-when-keypress-does-nothing

check keydown event characters length on macos
pull/23449/head
Alexander Smorkalov 2 years ago committed by GitHub
commit 20eee64426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/highgui/src/window_cocoa.mm

@ -618,7 +618,7 @@ CV_IMPL int cvWaitKey (int maxWait)
inMode:NSDefaultRunLoopMode inMode:NSDefaultRunLoopMode
dequeue:YES]; dequeue:YES];
if([event type] == NSKeyDown) { if([event type] == NSKeyDown && [[event characters] length]) {
returnCode = [[event characters] characterAtIndex:0]; returnCode = [[event characters] characterAtIndex:0];
break; break;
} }

Loading…
Cancel
Save