mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 13:41:05 +00:00
fix crash with saving null Dictionary
This commit is contained in:
parent
7fd27bc925
commit
2dc9837078
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue