diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_config.cpp | 5 | ||||
-rw-r--r-- | src/openttd.cpp | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 911d266df..a0e60ef75 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -603,6 +603,9 @@ public: bool GRFFileScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) { + /* Abort if the user stopped the game during a scan. */ + if (_exit_game) return false; + GRFConfig *c = new GRFConfig(filename.c_str() + basepath_length); bool added = true; @@ -702,7 +705,7 @@ void DoScanNewGRFFiles(NewGRFScanCallback *callback) /* Yes... these are the NewGRF windows */ InvalidateWindowClassesData(WC_SAVELOAD, 0, true); InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE, GOID_NEWGRF_RESCANNED, true); - if (callback != nullptr) callback->OnNewGRFsScanned(); + if (!_exit_game && callback != nullptr) callback->OnNewGRFsScanned(); DeleteWindowByClass(WC_MODAL_PROGRESS); SetModalProgress(false); diff --git a/src/openttd.cpp b/src/openttd.cpp index 035e8e5ae..235d36f01 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1469,6 +1469,8 @@ void GameLoop() ScanNewGRFFiles(_request_newgrf_scan_callback); _request_newgrf_scan = false; _request_newgrf_scan_callback = nullptr; + /* In case someone closed the game during our scan, don't do anything else. */ + if (_exit_game) return; } ProcessAsyncSaveFinish(); |