Fix asserts due to main window not existing yet

Partial revert of https://github.com/OpenTTD/OpenTTD/pull/10327
This commit is contained in:
Jonathan G Rennison
2023-01-27 17:56:17 +00:00
parent 32fe84cfdd
commit 4761750eae
4 changed files with 15 additions and 9 deletions

View File

@@ -338,7 +338,9 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti
ShowGenerateWorldProgress();
/* Centre the view on the map */
ScrollMainWindowToTile(TileXY(MapSizeX() / 2, MapSizeY() / 2), true);
if (FindWindowById(WC_MAIN_WINDOW, 0) != nullptr) {
ScrollMainWindowToTile(TileXY(MapSizeX() / 2, MapSizeY() / 2), true);
}
_GenerateWorld();
}