diff --git a/client/tileset/layer_terrain.cpp b/client/tileset/layer_terrain.cpp index d781f2f08d..2fb4da25f0 100644 --- a/client/tileset/layer_terrain.cpp +++ b/client/tileset/layer_terrain.cpp @@ -786,7 +786,12 @@ int layer_terrain::terrain_group(const terrain *pterrain) const return -1; } - return m_terrain_info.at(terrain_index(pterrain)).group->number; + auto group = m_terrain_info.at(terrain_index(pterrain)).group; + if (!group) { + return -1; + } + + return group->number; } namespace /* anonymous */ {