changeset 4998:b37782eacadf draft

(svn r7008) -Fix [FS#369]: Crash at game end when server company is bankrupt
author Darkvater <Darkvater@openttd.org>
date Tue, 31 Oct 2006 01:45:41 +0000
parents 43c10db4c352
children e9cfe06ebd92
files player_gui.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/player_gui.c
+++ b/player_gui.c
@@ -967,11 +967,14 @@
 {
 	switch (e->event) {
 	case WE_PAINT: {
-		const Player *p = GetPlayer(_local_player);
+		const Player *p;
 		uint x, y;
 
 		SetupHighScoreEndWindow(w, &x, &y);
 
+		if (!IsValidPlayer(_local_player)) break;
+
+		p = GetPlayer(_local_player);
 		/* We need to get performance from last year because the image is shown
 		 * at the start of the new year when these things have already been copied */
 		if (WP(w, highscore_d).background_img == SPR_TYCOON_IMG2_BEGIN) { // Tycoon of the century \o/