more console cleanups

(cherry picked from commit a66ff6407cdcdf233996f49c74d7a42537314562)
This commit is contained in:
AzaezelX 2023-04-28 17:13:45 -05:00
parent 339393aa85
commit fed381c945
3 changed files with 38 additions and 36 deletions

View file

@ -644,18 +644,20 @@ ImplementEnumType(_TamlFormatMode,
// Fetch field count.
const U32 fieldCount = fieldList.size();
ConsoleObject* defaultConObject;
SimObject* defaultObject;
ConsoleObject* defaultConObject = NULL;
SimObject* defaultObject = NULL;
if (!getWriteDefaults())
{
// Create a default object of the same type
defaultConObject = ConsoleObject::create(pSimObject->getClassName());
if (!defaultConObject)
return;
defaultObject = dynamic_cast<SimObject*>(defaultConObject);
// ***Really*** shouldn't happen
if (!defaultObject)
return;
}
// ***Really*** shouldn't happen
if (!defaultConObject || !defaultObject)
return;
// Iterate fields.
U8 arrayDepth = 0;
@ -754,7 +756,7 @@ ImplementEnumType(_TamlFormatMode,
}
// Save field/value.
if (arrayDepth > 0 || pField->elementCount > 1)
if (currentArrayNode && (arrayDepth > 0 || pField->elementCount > 1))
currentArrayNode->getChildren()[elementIndex]->addField(fieldName, pFieldValue);
else
{