summaryrefslogtreecommitdiff
path: root/core/variant
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-13 12:59:02 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-13 12:59:02 +0100
commit4a2c2170b40b4e5562c9ad0f1e0ed84c6bf5c7b7 (patch)
tree8a00bb0cfa870a506e862d042f7df78f528ba7c5 /core/variant
parent848c910227fa7be2da7285ea5162597bf13adc15 (diff)
parent44b2747dfd0a91b90c95f00a214dead97fb41bf7 (diff)
Merge pull request #62921 from cdemirer/fix-variant-in
Fix `Variant::in()` error on invalid `evaluate`
Diffstat (limited to 'core/variant')
-rw-r--r--core/variant/variant_op.cpp7
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);
}