Author: cazfi
Date: Tue Feb 16 15:55:33 2016
New Revision: 31941

URL: http://svn.gna.org/viewcvs/freeciv?rev=31941&view=rev
Log:
Fixed access from negative array index when logging worker want of oceanic city.

See bug #24405

Modified:
    trunk/ai/default/aicity.c

Modified: trunk/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=31941&r1=31940&r2=31941&view=diff
==============================================================================
--- trunk/ai/default/aicity.c   (original)
+++ trunk/ai/default/aicity.c   Tue Feb 16 15:55:33 2016
@@ -800,14 +800,23 @@
   }
   want = MAX(want, 0);
 
-  CITY_LOG(LOG_DEBUG, pcity, "wants %s with want %d to do %s at (%d,%d), "
-           "we have %d workers and %d cities on the continent",
-          utype_rule_name(utype),
-          want,
-          get_activity_text(best_act),
-          TILE_XY(best_tile),
-           ai->stats.workers[place], 
-           adv->stats.cities[place]);
+  if (place >= 0) {
+    CITY_LOG(LOG_DEBUG, pcity, "wants %s with want %d to do %s at (%d,%d), "
+             "we have %d workers and %d cities on the continent",
+             utype_rule_name(utype),
+             want,
+             get_activity_text(best_act),
+             TILE_XY(best_tile),
+             ai->stats.workers[place], 
+             adv->stats.cities[place]);
+  } else {
+    CITY_LOG(LOG_DEBUG, pcity, "wants %s with want %d to do %s at (%d,%d)",
+             utype_rule_name(utype),
+             want,
+             get_activity_text(best_act),
+             TILE_XY(best_tile));
+  }
+
   fc_assert(want >= 0);
 
   city_data->settler_want = want;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to