summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-11-08 00:01:21 +0100
committerkobewi <kobewi4e@gmail.com>2023-11-08 12:13:36 +0100
commit275e9d7028bc2e0d4f6c9a74d91ededce0631b40 (patch)
treec79e7a2b771939f682ec87e6d760e2e00f966e9f
parent3e7f638d7b574785f521beafaf52a6ad95be016f (diff)
downloadredot-engine-275e9d7028bc2e0d4f6c9a74d91ededce0631b40.tar.gz
Keep Variant type after zero()
-rw-r--r--core/variant/variant.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index 09fb34e7c1..4c0212075b 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -1291,7 +1291,13 @@ void Variant::zero() {
break;
default:
+ Type prev_type = type;
this->clear();
+ if (type != prev_type) {
+ // clear() changes type to NIL, so it needs to be restored.
+ Callable::CallError ce;
+ Variant::construct(prev_type, *this, nullptr, 0, ce);
+ }
break;
}
}