Skip to content

Commit

Permalink
Merge pull request #84597 from KoBeWi/zeroed_existence
Browse files Browse the repository at this point in the history
Keep Variant type after `zero()`
  • Loading branch information
akien-mga committed Nov 8, 2023
2 parents 2cfb5ff + 275e9d7 commit ae20b74
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/variant/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit ae20b74

Please sign in to comment.