Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2005:
[Freeciv-Dev] Re: (PR#14514) segmentation fault when using /rulesetdir f
Home

[Freeciv-Dev] Re: (PR#14514) segmentation fault when using /rulesetdir f

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: cwarren89@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#14514) segmentation fault when using /rulesetdir from client
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Tue, 1 Nov 2005 03:37:54 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14514 >

Dnia 2005-11-01 02:27:52, Curtis napisał(a):
> 
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=14514 >
> 
> When sending the the command '/rulsetdir [whatever]' from the server
> segmentation faults due to a bad pointer. The following is the gdb
> session of the server during said events. As I do not know much about
> this particular area of code, I will leave the fix to someone else.
> 
Here's a patch
--
mateusz

Index: server/ruleset.c
===================================================================
--- server/ruleset.c    (wersja 11206)
+++ server/ruleset.c    (kopia robocza)
@@ -3063,6 +3063,7 @@
 {
   players_iterate(pplayer) {
     pplayer->nation = NO_NATION_SELECTED;
+    pplayer->city_style = 0;
   } players_iterate_end;
   send_player_info_c(NULL, game.est_connections);
 }
Index: server/plrhand.c
===================================================================
--- server/plrhand.c    (wersja 11206)
+++ server/plrhand.c    (kopia robocza)
@@ -889,7 +889,11 @@
   packet->is_male=plr->is_male;
   packet->team = plr->team ? plr->team->index : -1;
   packet->is_ready = plr->is_ready;
-  packet->city_style = get_player_city_style(plr);
+  if (city_styles != NULL) {
+    packet->city_style = get_player_city_style(plr);
+  } else {
+    packet->city_style = 0;
+  }
 
   packet->is_alive=plr->is_alive;
   packet->is_connected=plr->is_connected;


[Prev in Thread] Current Thread [Next in Thread]