summaryrefslogtreecommitdiff
path: root/src/main_gui.cpp
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2007-01-14 21:32:13 +0000
committerDarkvater <darkvater@openttd.org>2007-01-14 21:32:13 +0000
commite4d4e13e15385ea6628c8d6ae54a697ad69f8dc9 (patch)
treee69c4dfbbfc374b6a29fa377e87301e68172523c /src/main_gui.cpp
parentf8a434e9fc808dcac88b851386df5348ebbbda43 (diff)
downloadopenttd-e4d4e13e15385ea6628c8d6ae54a697ad69f8dc9.tar.xz
(svn r8132) -Fix (r6824): The game could crash when the chat key (<ENTER>) is pressed too vehemently during the join of the game. Your client's id does not exist in the clients list yet, and returns NULL.
Diffstat (limited to 'src/main_gui.cpp')
-rw-r--r--src/main_gui.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index b333d6ec1..e88a306c5 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -2302,6 +2302,8 @@ static void MainWindowWndProc(Window *w, WindowEvent *e)
const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index);
bool teamchat = false;
+ if (cio == NULL) break;
+
/* Only players actually playing can speak to team. Eg spectators cannot */
if (_patches.prefer_teamchat && IsValidPlayer(cio->client_playas)) {
const NetworkClientInfo *ci;
@@ -2323,8 +2325,10 @@ static void MainWindowWndProc(Window *w, WindowEvent *e)
case WKC_CTRL | WKC_RETURN: case WKC_CTRL | 'T': // send text to all team mates
if (_networking) {
- const NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
- ShowNetworkChatQueryWindow(DESTTYPE_TEAM, ci->client_playas);
+ const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index);
+ if (cio == NULL) break;
+
+ ShowNetworkChatQueryWindow(DESTTYPE_TEAM, cio->client_playas);
}
break;
#endif