From 0a823e85d249e9a844f0252deb062efaeafa2d29 Mon Sep 17 00:00:00 2001 From: Julien Nguyen Date: Wed, 30 Jun 2021 21:22:23 +0200 Subject: [PATCH] Fix 'in' operator to check if an object member exists --- core/variant/variant_op.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/variant/variant_op.h b/core/variant/variant_op.h index e744e76ea30..cbdd60f4043 100644 --- a/core/variant/variant_op.h +++ b/core/variant/variant_op.h @@ -1261,8 +1261,10 @@ public: const String &a = *VariantGetInternalPtr::get_ptr(&p_left); - b->get(a, &r_valid); - *r_ret = r_valid; + bool exist; + b->get(a, &exist); + *r_ret = exist; + r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { Object *l = right->get_validated_object(); @@ -1293,8 +1295,10 @@ public: const StringName &a = *VariantGetInternalPtr::get_ptr(&p_left); - b->get(a, &r_valid); - *r_ret = r_valid; + bool exist; + b->get(a, &exist); + *r_ret = exist; + r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { Object *l = right->get_validated_object();