From 3ee666f005c07f3d746b3e4e6d6d59e765e08e8b Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 3 Jul 2022 08:54:40 +0300 Subject: [PATCH 54/54] Fix dai_is_unit_tired_waiting_boat() crash Even if the unit had no homecity, homecity tile would have been used. I don't know if it's actually possible for a unit without homecity to ever end evaluated here with the current codebase. See osdn #44987 Signed-off-by: Marko Lindqvist --- ai/default/aiunit.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ai/default/aiunit.c b/ai/default/aiunit.c index c53d31a06c..7e0808b86f 100644 --- a/ai/default/aiunit.c +++ b/ai/default/aiunit.c @@ -2114,8 +2114,13 @@ static bool dai_is_unit_tired_waiting_boat(struct ai_type *ait, if (src == NULL || dest == NULL) { return FALSE; } - /* if we're not at home continent (FIXME: well, why?) */ - if (tile_continent(src) != tile_continent(src_home_city)) { + + /* If we have a home continent, and are not there. + * (FIXME: well, why?) + * (I guess because home continent is which we were supposed to leave, + * not the target continent) */ + if (src_home_city != NULL + && tile_continent(src) != tile_continent(src_home_city)) { return FALSE; } -- 2.35.1