Fix asserts due to main window not existing yet
Partial revert of https://github.com/OpenTTD/OpenTTD/pull/10327
This commit is contained in:
@@ -2196,7 +2196,8 @@ struct MainToolbarWindow : Window {
|
||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
HandleZoomMessage(this, GetMainWindow()->viewport, WID_TN_ZOOM_IN, WID_TN_ZOOM_OUT);
|
||||
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||
if (w != nullptr) HandleZoomMessage(this, w->viewport, WID_TN_ZOOM_IN, WID_TN_ZOOM_OUT);
|
||||
}
|
||||
|
||||
static HotkeyList hotkeys;
|
||||
@@ -2577,7 +2578,8 @@ struct ScenarioEditorToolbarWindow : Window {
|
||||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
HandleZoomMessage(this, GetMainWindow()->viewport, WID_TE_ZOOM_IN, WID_TE_ZOOM_OUT);
|
||||
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||
if (w != nullptr) HandleZoomMessage(this, w->viewport, WID_TE_ZOOM_IN, WID_TE_ZOOM_OUT);
|
||||
}
|
||||
|
||||
void OnQueryTextFinished(char *str) override
|
||||
|
Reference in New Issue
Block a user