diff --git a/src/common/scripting/core/types.cpp b/src/common/scripting/core/types.cpp index 705d38c9b52..c38eec7a851 100644 --- a/src/common/scripting/core/types.cpp +++ b/src/common/scripting/core/types.cpp @@ -2605,23 +2605,26 @@ static bool PMapValueReader(FSerializer &ar, M *map, const PMap *m) const char * k; if(m->KeyType == TypeName) { - typename M::ValueType * val; - if constexpr(std::is_same_v) - { - val = &map->InsertNew(FName(k).GetIndex()); - } - else - { - #ifdef __GNUC__ - __builtin_unreachable(); - #elif defined(_MSC_VER) - __assume(0); - #endif - } - if (!m->ValueType->ReadValue(ar,nullptr,static_cast(val))) + while((k = ar.GetKey())) { - ar.EndObject(); - return false; + typename M::ValueType * val; + if constexpr(std::is_same_v) + { + val = &map->InsertNew(FName(k).GetIndex()); + } + else + { + #ifdef __GNUC__ + __builtin_unreachable(); + #elif defined(_MSC_VER) + __assume(0); + #endif + } + if (!m->ValueType->ReadValue(ar,nullptr,static_cast(val))) + { + ar.EndObject(); + return false; + } } } else