summaryrefslogtreecommitdiff
path: root/core/variant/variant_op.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant/variant_op.cpp')
-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);
}