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

 Another instance where enemy's inability to build anything caused crash.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aitools.c freeciv/ai/aitools.c
--- freeciv/ai/aitools.c	2007-07-04 14:04:26.000000000 +0300
+++ freeciv/ai/aitools.c	2007-08-13 00:17:33.000000000 +0300
@@ -238,9 +238,12 @@
     /* Assume enemy will build another defender, add it's attack strength */
     struct unit_type *d_type = ai_choose_defender_versus(dcity, unit_type(punit));
 
-    danger += 
-      unittype_att_rating(d_type, do_make_unit_veteran(dcity, d_type), 
-                          SINGLE_MOVE, d_type->hp);
+    if (d_type) {
+      /* Enemy really can build something */
+      danger += 
+        unittype_att_rating(d_type, do_make_unit_veteran(dcity, d_type), 
+                            SINGLE_MOVE, d_type->hp);
+    }
   }
   danger *= POWER_DIVIDER;
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to