Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] Re: (PR#11418) AutoReply: loading saved games causes a cra
Home

[Freeciv-Dev] Re: (PR#11418) AutoReply: loading saved games causes a cra

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#11418) AutoReply: loading saved games causes a crash in 2.0
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Dec 2004 17:42:23 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Sorry, I should mention it's a client crash.

(gdb) bt
#0  0x4018e741 in kill () from /usr/lib/debug/libc.so.6
#1  0x4018e4c5 in *__GI_raise (sig=6)
     at ../linuxthreads/sysdeps/unix/sysv/linux/raise.c:32
#2  0x4018fa08 in *__GI_abort () at ../sysdeps/generic/abort.c:88
#3  0x40187b3f in *__GI___assert_fail (assertion=0x0, file=0x0, line=0,
     function=0x816fe50 "cm_query_result") at assert.c:83
#4  0x08136a78 in cm_query_result (pcity=0x874f420, param=0xbffff4d0,
     result=0xbffff480) at cm.c:1803
#5  0x0806c931 in auto_arrange_workers (pcity=0x874f420) at cityturn.c:238
#6  0x08122ee7 in ai_best_government (pplayer=0x82084f8) at aihand.c:269
#7  0x0811fc99 in ai_data_turn_init (pplayer=0x82084f8) at aidata.c:379
#8  0x0804fff8 in begin_phase (is_new_phase=false) at srv_main.c:525
#9  0x08051db0 in main_loop () at srv_main.c:1550
#10 0x08052658 in srv_loop () at srv_main.c:1902
#11 0x08051fc0 in srv_main () at srv_main.c:1669
#12 0x0804a96c in main (argc=8, argv=0xbffff774) at civserver.c:202

This is a "better" patch for the dev branch.  As I said we shouldn't be 
looking up sprites for nonexistent techs.

jason


Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.217
diff -u -r1.217 tilespec.c
--- client/tilespec.c   8 Dec 2004 20:48:33 -0000       1.217
+++ client/tilespec.c   9 Dec 2004 01:40:57 -0000
@@ -1580,13 +1580,17 @@
 ***********************************************************************/
 void tilespec_setup_tech_type(int id)
 {
-  advances[id].sprite
-    = lookup_sprite_tag_alt(advances[id].graphic_str,
-                           advances[id].graphic_alt,
-                           FALSE, "tech_type",
-                           get_tech_name(game.player_ptr, id));
+  if (tech_exists(id)) {
+    advances[id].sprite
+      = lookup_sprite_tag_alt(advances[id].graphic_str,
+                             advances[id].graphic_alt,
+                             FALSE, "tech_type",
+                             get_tech_name(game.player_ptr, id));
 
-  /* should maybe do something if NULL, eg generic default? */
+    /* should maybe do something if NULL, eg generic default? */
+  } else {
+    advances[id].sprite = NULL;
+  }
 }
 
 /**********************************************************************

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