From cb7dab4052877a3879fc114955aaff72b622bf47 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Sat, 10 May 2025 19:37:09 +0100 Subject: [PATCH] Update console.h --- Engine/source/console/console.h | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index e2a014024..6a1dc7942 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -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: