From 01590dacf3482f95be3f15d83acbf4f049cadf13 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 25 Dec 2011 22:15:13 +0000 Subject: [PATCH] make sure there's a screen before attempting to constrain info window size --- macosx/InfoWindowController.m | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index d60821581..6fd50c42c 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -302,14 +302,17 @@ typedef enum if ([fViewController respondsToSelector: @selector(saveViewSize)]) //a little bit hacky, but avoids requiring an extra method { - const CGFloat screenHeight = NSHeight([[window screen] visibleFrame]); - if (NSHeight(windowRect) > screenHeight) + if ([window screen]) { - const CGFloat difference = (screenHeight - NSHeight(windowRect)) * [window userSpaceScaleFactor]; - windowRect.origin.y -= difference; - windowRect.size.height += difference; - - viewRect.size.height += difference; + const CGFloat screenHeight = NSHeight([[window screen] visibleFrame]); + if (NSHeight(windowRect) > screenHeight) + { + const CGFloat difference = (screenHeight - NSHeight(windowRect)) * [window userSpaceScaleFactor]; + windowRect.origin.y -= difference; + windowRect.size.height += difference; + + viewRect.size.height += difference; + } } [window setMinSize: NSMakeSize([window minSize].width, NSHeight(windowRect) - NSHeight(viewRect) + TAB_MIN_HEIGHT)];