Update console.h

This commit is contained in:
marauder2k7 2025-05-10 19:37:09 +01:00
parent 656a8ac0bd
commit cb7dab4052

View file

@ -154,37 +154,18 @@ class ConsoleValue
TORQUE_FORCEINLINE bool hasAllocatedData() const
{
return (isConsoleType() && data != NULL);
return (type == ConsoleValueType::cvString || isConsoleType()) && data != NULL;
}
const char* getConsoleData() const;
TORQUE_FORCEINLINE void cleanupData()
{
switch (type)
{
case ConsoleValueType::cvConsoleValueType:
if (ct)
{
delete ct;
ct = nullptr;
}
break;
case ConsoleValueType::cvString:
if (s && s != StringTable->EmptyString())
dFree(s);
break;
default:
break;
}
if (data != NULL)
if (hasAllocatedData())
{
dFree(data);
data = NULL;
}
type = ConsoleValueType::cvNULL;
}
public: