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

 This fixes process_attacker_want() crash when enemy cannot build
defending units.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c
--- freeciv/ai/advmilitary.c	2007-03-18 23:27:54.000000000 +0200
+++ freeciv/ai/advmilitary.c	2007-03-19 03:05:43.000000000 +0200
@@ -930,10 +930,14 @@
       }
 
       /* Estimate strength of the enemy. */
-      
-      vuln = unittype_def_rating_sq(punittype, victim_unit_type,
-				    victim_player,
-                                    ptile, FALSE, veteran);
+
+      if (victim_unit_type) {
+        vuln = unittype_def_rating_sq(punittype, victim_unit_type,
+                                      victim_player,
+                                      ptile, FALSE, veteran);
+      } else {
+        vuln = 0;
+      }
 
       /* Not bothering to s/!vuln/!pdef/ here for the time being. -- Syela
        * (this is noted elsewhere as terrible bug making warships yoyoing) 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to