Author: cazfi
Date: Thu May 18 15:23:46 2017
New Revision: 35648

URL: http://svn.gna.org/viewcvs/freeciv?rev=35648&view=rev
Log:
Fix NULL dereference when there's no suitable founder unit type

See hrm Bug #661409

Modified:
    trunk/ai/default/daidomestic.c

Modified: trunk/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daidomestic.c?rev=35648&r1=35647&r2=35648&view=diff
==============================================================================
--- trunk/ai/default/daidomestic.c      (original)
+++ trunk/ai/default/daidomestic.c      Thu May 18 15:23:46 2017
@@ -475,7 +475,7 @@
   worker_want = city_data->worker_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-    if (!worker_type || worker_type->pop_cost > 0) {
+    if (worker_type == NULL || worker_type->pop_cost > 0) {
       worker_want /= 5;
     } else {
       worker_want /= 2;
@@ -509,13 +509,13 @@
     founder_want = city_data->founder_want;
 
     if (adv->wonder_city == pcity->id) {
-      if (founder_type->pop_cost > 0) {
+      if (founder_type == NULL || founder_type->pop_cost > 0) {
         founder_want /= 5;
       } else {
         founder_want /= 2;
       }
     }
-    
+
     if (adv->max_num_cities <= city_list_size(pplayer->cities)) {
       founder_want /= 100;
     }


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

Reply via email to