From 656a8ac0bd78f8e54a4a5cf2394e5e05aa8ed7c4 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Sat, 10 May 2025 14:46:49 +0100 Subject: [PATCH] Update console.h --- Engine/source/console/console.h | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index e5ba8ffe7..e2a014024 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -161,16 +161,29 @@ class ConsoleValue 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; } - else if (type == ConsoleValueType::cvString) - { - if (s != StringTable->EmptyString()) - dFree(s); - } + type = ConsoleValueType::cvNULL; }