diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-11-08 19:10:23 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-11-08 19:10:23 +0100 |
commit | ae20b74ad58d77d3840c5535945f3fa70cd590bc (patch) | |
tree | a50ad0b60a0a92e70611ad7a1571e5f1d5e26913 /core/variant/variant.cpp | |
parent | 2cfb5ff23aaffd91042cab6d11a1548227a57239 (diff) | |
parent | 275e9d7028bc2e0d4f6c9a74d91ededce0631b40 (diff) | |
download | redot-engine-ae20b74ad58d77d3840c5535945f3fa70cd590bc.tar.gz |
Merge pull request #84597 from KoBeWi/zeroed_existence
Keep Variant type after `zero()`
Diffstat (limited to 'core/variant/variant.cpp')
-rw-r--r-- | core/variant/variant.cpp | 6 |
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; } } |