Skip to content

Commit

Permalink
Fix a crash in map_is_known
Browse files Browse the repository at this point in the history
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()).
  • Loading branch information
lmoureaux committed May 10, 2022
1 parent 205e004 commit 3396735
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/maphand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down

0 comments on commit 3396735

Please sign in to comment.