diff options
author | cdemirer <41021322+cdemirer@users.noreply.github.com> | 2022-07-11 20:11:27 +0300 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2023-02-13 12:37:41 +0100 |
commit | 44b2747dfd0a91b90c95f00a214dead97fb41bf7 (patch) | |
tree | bf734164d9c7ea4260b2a2912c2663aba3e9daaf /core/variant | |
parent | b7723a01d957e6492a3f20bce8a47d3559afe5c5 (diff) |
Fix `Variant::in()` error on invalid `evaluate`
Diffstat (limited to 'core/variant')
-rw-r--r-- | core/variant/variant_op.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index 59f562865d..33c285dc6d 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -1105,8 +1105,11 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { evaluate(OP_IN, p_index, *this, ret, valid); if (r_valid) { *r_valid = valid; + } + if (valid) { + ERR_FAIL_COND_V(ret.type != BOOL, false); + return *VariantGetInternalPtr<bool>::get_ptr(&ret); + } else { return false; } - ERR_FAIL_COND_V(ret.type != BOOL, false); - return *VariantGetInternalPtr<bool>::get_ptr(&ret); } |