Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13478) don't dereference T_UNKNOWN in the client goto
Home

[Freeciv-Dev] (PR#13478) don't dereference T_UNKNOWN in the client goto

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13478) don't dereference T_UNKNOWN in the client goto code
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Mon, 18 Jul 2005 03:39:05 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [mstefek - Sat Jul 16 08:51:48 2005]:
> 
> > [jdorje - Sat Jul 16 03:39:02 2005]:
> > 
> > All known bugs with T_UNKNOWN dereferences are now fixed.  Surely there
> > are some more bugs out there.  Send any backtraces for crashes; a
> > backtrace is probably enough to find the problem.
> > 
> Here you are, looks like I've found new city in a hut:
> 
Actually AI build a city near my explorer.
Here's a patch
--
mateusz
Index: common/terrain.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.c,v
retrieving revision 1.26
diff -u -r1.26 terrain.c
--- common/terrain.c    14 Jul 2005 19:25:45 -0000      1.26
+++ common/terrain.c    18 Jul 2005 10:35:16 -0000
@@ -375,7 +375,12 @@
                               enum terrain_flag_id flag)
 {
   adjc_iterate(ptile, adjc_tile) {
-    if (terrain_has_flag(tile_get_terrain(adjc_tile), flag)) {
+    struct terrain* pterrain = tile_get_terrain(adjc_tile);
+    if (pterrain == NULL) {
+      continue;
+    }
+    
+    if (terrain_has_flag(pterrain, flag)) {
       return TRUE;
     }
   } adjc_iterate_end;

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