fix: don't return reference to object that goes out of scope

Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
map-per
2025-12-17 15:22:06 +01:00
parent 8007c0df53
commit 21c9a58173
2 changed files with 3 additions and 1 deletions

View File

@@ -152,7 +152,7 @@ std::vector<OSMTag> const & TypeToOSMTranslator::OsmTagsFromType(uint32_t type)
if (it == m_storage.end())
{
ASSERT(false, ("OSM tags for type", type, "could not be found"));
return {};
return kEmptyResult;
}
return it->second;

View File

@@ -16,6 +16,8 @@ struct OSMTag
class TypeToOSMTranslator
{
public:
std::vector<OSMTag> static constexpr kEmptyResult = {};
TypeToOSMTranslator() : TypeToOSMTranslator(true) {}
explicit TypeToOSMTranslator(bool initialize);