diff options
author | George Marques <george@gmarqu.es> | 2021-07-13 14:25:42 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 14:25:42 -0300 |
commit | 7bc52e56c093342255c389fcc652eda2ced40b39 (patch) | |
tree | c1e2af38dd8891008e32b3c1f6a5dbd31d5a2d87 | |
parent | e2a2138d2bcd5f5f5c7dde8d9371c62192d459f1 (diff) | |
parent | 0a823e85d249e9a844f0252deb062efaeafa2d29 (diff) |
Merge pull request #50056 from Blackiris/fix-in-operator
Fix 'in' operator to check if an object member exists
-rw-r--r-- | core/variant/variant_op.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/variant/variant_op.h b/core/variant/variant_op.h index e744e76ea3..cbdd60f404 100644 --- a/core/variant/variant_op.h +++ b/core/variant/variant_op.h @@ -1261,8 +1261,10 @@ public: const String &a = *VariantGetInternalPtr<String>::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<StringName>::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(); |