Author: cazfi
Date: Mon May  1 19:46:03 2017
New Revision: 35359

URL: http://svn.gna.org/viewcvs/freeciv?rev=35359&view=rev
Log:
Fix AI crash when there's no suitable ferryboat type

Reported by Eric <koqebwix>

See gna bug #25628

Modified:
    branches/S3_0/ai/default/daimilitary.c

Modified: branches/S3_0/ai/default/daimilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/daimilitary.c?rev=35359&r1=35358&r2=35359&view=diff
==============================================================================
--- branches/S3_0/ai/default/daimilitary.c      (original)
+++ branches/S3_0/ai/default/daimilitary.c      Mon May  1 19:46:03 2017
@@ -1287,9 +1287,9 @@
       /* We might need a new boat even if there are boats free,
        * if they are blockaded or in inland seas*/
       fc_assert_ret_val(unit_class_get(myunit)->adv.sea_move != MOVE_FULL, 
choice);
-      dai_choose_role_unit(ait, pplayer, pcity, choice, CT_ATTACKER,
-                           L_FERRYBOAT, choice->want, TRUE);
-      if (dai_is_ferry_type(choice->value.utype, ait)) {
+      if (dai_choose_role_unit(ait, pplayer, pcity, choice, CT_ATTACKER,
+                              L_FERRYBOAT, choice->want, TRUE)
+         && dai_is_ferry_type(choice->value.utype, ait)) {
 #ifdef FREECIV_DEBUG
         struct ai_plr *ai = dai_plr_data_get(ait, pplayer, NULL);
 


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

Reply via email to