From 33967352a40c6bf0a605ce31fd7fcbc036bcbf52 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Tue, 10 May 2022 03:26:00 +0200 Subject: [PATCH] Fix a crash in map_is_known When invoking map_is_known before the map is initialized, it would crash with an assertion error in QVector. This was the case for instance when calling it indirectly from the "map_generated" callback (using tile:remove_extra()). --- server/maphand.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/maphand.cpp b/server/maphand.cpp index f54987fd39..76e2d398b3 100644 --- a/server/maphand.cpp +++ b/server/maphand.cpp @@ -902,7 +902,8 @@ void map_show_all(struct player *pplayer) */ bool map_is_known(const struct tile *ptile, const struct player *pplayer) { - return pplayer->tile_known->at(tile_index(ptile)); + return !pplayer->tile_known->isEmpty() + && pplayer->tile_known->at(tile_index(ptile)); } /**