From e82ff813077c8a68dc5a06ff6650425aabce7048 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Sat, 7 Jan 2023 23:07:37 +0100 Subject: [PATCH] Fix a crash with sprite_type = "hex_cell" (cherry picked from commit ea2931c935780eea403b0ff924f2e6797c13780f) --- client/layer_terrain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/layer_terrain.cpp b/client/layer_terrain.cpp index eb967e2225..1ee7549dca 100644 --- a/client/layer_terrain.cpp +++ b/client/layer_terrain.cpp @@ -933,8 +933,9 @@ void layer_terrain::fill_terrain_sprite_array( // Not matching against this terrain, pretend current terrain // continues (it's always at match index 0) indices[j] = 0; + } else { + indices[j] = std::distance(info.matches_with.begin(), it); } - indices[j] = std::distance(info.matches_with.begin(), it); } // Pick the sprite