From 0df6e99a7541a6e8f6850d489528de4ac23172a4 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Sun, 11 May 2025 15:53:59 +0100 Subject: [PATCH] Revert "Update console.h" This reverts commit f10080489995570036e2e5ba762357559a0abd34. --- Engine/source/console/console.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 6a1dc7942..e2a014024 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -154,18 +154,37 @@ class ConsoleValue TORQUE_FORCEINLINE bool hasAllocatedData() const { - return (type == ConsoleValueType::cvString || isConsoleType()) && data != NULL; + return (isConsoleType() && data != NULL); } const char* getConsoleData() const; TORQUE_FORCEINLINE void cleanupData() { - if (hasAllocatedData()) + 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) { dFree(data); data = NULL; } + + type = ConsoleValueType::cvNULL; } public: