From 3bd85d417ea862c67b17d884691c729b3ba1fb92 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 13 Dec 2023 16:55:38 +0200 Subject: [PATCH] Avoid crash on invalid building identifier --- lib/mapObjectConstructors/CommonConstructors.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mapObjectConstructors/CommonConstructors.cpp b/lib/mapObjectConstructors/CommonConstructors.cpp index 6a558b96a..f8670ce31 100644 --- a/lib/mapObjectConstructors/CommonConstructors.cpp +++ b/lib/mapObjectConstructors/CommonConstructors.cpp @@ -77,7 +77,7 @@ void CTownInstanceConstructor::afterLoadFinalization() { filters[entry.first] = LogicalExpression(entry.second, [this](const JsonNode & node) { - return BuildingID(VLC->identifiers()->getIdentifier("building." + faction->getJsonKey(), node.Vector()[0]).value()); + return BuildingID(VLC->identifiers()->getIdentifier("building." + faction->getJsonKey(), node.Vector()[0]).value_or(-1)); }); } }