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
1 changed files with 6 additions and 1 deletions

View File

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