Author: cazfi
Date: Mon May  1 19:46:10 2017
New Revision: 35360

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

Reported by Eric <koqebwix>

See gna bug #25628

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

Modified: branches/S2_6/ai/default/daimilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/daimilitary.c?rev=35360&r1=35359&r2=35360&view=diff
==============================================================================
--- branches/S2_6/ai/default/daimilitary.c      (original)
+++ branches/S2_6/ai/default/daimilitary.c      Mon May  1 19:46:10 2017
@@ -1286,9 +1286,9 @@
       /* We might need a new boat even if there are boats free,
        * if they are blockaded or in inland seas*/
       fc_assert_ret(unit_class_get(myunit)->adv.sea_move != MOVE_FULL);
-      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