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; }