fix crash with saving null Dictionary

This commit is contained in:
Alexander Kromm 2019-12-30 20:26:40 +07:00 committed by Christoph Oelckers
parent 7fd27bc925
commit 2dc9837078

View file

@ -2185,6 +2185,11 @@ FString DictionaryToString(const Dictionary &dict)
Dictionary *DictionaryFromString(const FString &string) Dictionary *DictionaryFromString(const FString &string)
{ {
if (string.IsEmpty())
{
return nullptr;
}
Dictionary *const dict = new Dictionary; Dictionary *const dict = new Dictionary;
rapidjson::Document doc; rapidjson::Document doc;
@ -2214,7 +2219,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, Dictionary
{ {
if (arc.isWriting()) if (arc.isWriting())
{ {
FString contents { DictionaryToString(*dict) }; FString contents { dict ? DictionaryToString(*dict) : "" };
return arc(key, contents); return arc(key, contents);
} }
else else