Protect against [window screen] returning nil.

This commit is contained in:
fredkiefer 2017-10-05 23:05:28 +02:00
parent 020d3fa183
commit e3d51643ca
3 changed files with 20 additions and 3 deletions

View file

@ -1545,7 +1545,7 @@ static BOOL menuBarVisible = YES;
[_view sizeToFit];
menuFrame = [_view frame];
// Main
oldWindowFrame = [_aWindow frame];
newWindowFrame = [NSWindow frameRectForContentRect: menuFrame
@ -1855,7 +1855,15 @@ static BOOL menuBarVisible = YES;
NSWindow *window;
window = [self window];
return !NSContainsRect([[window screen] visibleFrame], [window frame]);
if ((nil != window) && (nil != [window screen]))
{
return !NSContainsRect([[window screen] visibleFrame], [window frame]);
}
else
{
NSLog(@"Menu has no window %@ or screen %@", window, [window screen]);
return YES;
}
}
- (void) _performMenuClose: (id)sender