# HG changeset patch # User alberth # Date 1257138778 0 # Node ID 96f90810731da5e035fdadc1866f475455ba5d56 # Parent ce0bf92f93696d8d604ab58330d82d4f604eed9f (svn r17945) -Fix (r17940): Absence of main toolbar and/or status bar should not be fatal. diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -593,9 +593,9 @@ * Add a fixed distance 20 to make it less cluttered. */ const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); - int scr_top = w->top + w->height + 20; + int scr_top = ((w != NULL) ? w->top + w->height : 0) + 20; w = FindWindowById(WC_STATUS_BAR, 0); - int scr_bot = w->top - 20; + int scr_bot = ((w != NULL) ? w->top : _screen.height) - 20; Point pt = RemapCoords2(this->position.x, this->position.y); const ViewPort *vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport; @@ -810,9 +810,9 @@ * Add a fixed distance 2 so the tooltip floats free from both bars. */ const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); - int scr_top = w->top + w->height + 2; + int scr_top = ((w != NULL) ? w->top + w->height : 0) + 2; w = FindWindowById(WC_STATUS_BAR, 0); - int scr_bot = w->top - 2; + int scr_bot = ((w != NULL) ? w->top : _screen.height) - 2; Point pt;