diff options
author | rubidium42 <rubidium@openttd.org> | 2021-05-01 14:41:25 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-05-01 18:30:08 +0200 |
commit | 05394d5216f89c9a7e14487b571515e510828657 (patch) | |
tree | 5b776de934917aeb88b09486fc1309a22467a6bf /src/openttd.cpp | |
parent | 83985fe26f1ad87df709f122f74e5d50485095fa (diff) | |
download | openttd-05394d5216f89c9a7e14487b571515e510828657.tar.xz |
Fix #6598: Prevent invalid memory accesses when abandoning a join from within a network game
One could join a network game from within an already running network game. This would call a NetworkDisconnect, but keeps the UI alive. If, during that process the join is aborted, e.g. by cancelling on a password dialog, you would still be in your network game but also get shown the server list.
Solve all the underlying problems by falling back to the main UI when (re)connecting to a(nother) server.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index fbeeba793..234e3a419 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1068,6 +1068,11 @@ void SwitchToMode(SwitchMode new_mode) break; } + case SM_JOIN_GAME: // Join a multiplayer game + LoadIntroGame(); + NetworkClientJoinGame(); + break; + case SM_MENU: // Switch to game intro menu LoadIntroGame(); if (BaseSounds::ini_set.empty() && BaseSounds::GetUsedSet()->fallback && SoundDriver::GetInstance()->HasOutput()) { |