From 60dfa3445a84c479dd138c5ca26049fab69e3f01 Mon Sep 17 00:00:00 2001 From: gilzoide Date: Sun, 24 Sep 2023 17:10:29 -0300 Subject: [PATCH] Fix return value and r_valid value in Variant::iter_init and iter_next --- src/variant/variant.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/variant/variant.cpp b/src/variant/variant.cpp index 641f59c..db15be1 100644 --- a/src/variant/variant.cpp +++ b/src/variant/variant.cpp @@ -638,14 +638,16 @@ bool Variant::in(const Variant &index, bool *r_valid) const { bool Variant::iter_init(Variant &r_iter, bool &r_valid) const { GDExtensionBool valid; - internal::gdextension_interface_variant_iter_init(_native_ptr(), r_iter._native_ptr(), &valid); - return PtrToArg::convert(&valid); + GDExtensionBool result = internal::gdextension_interface_variant_iter_init(_native_ptr(), r_iter._native_ptr(), &valid); + r_valid = PtrToArg::convert(&valid); + return PtrToArg::convert(&result); } bool Variant::iter_next(Variant &r_iter, bool &r_valid) const { GDExtensionBool valid; - internal::gdextension_interface_variant_iter_next(_native_ptr(), r_iter._native_ptr(), &valid); - return PtrToArg::convert(&valid); + GDExtensionBool result = internal::gdextension_interface_variant_iter_next(_native_ptr(), r_iter._native_ptr(), &valid); + r_valid = PtrToArg::convert(&valid); + return PtrToArg::convert(&result); } Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const {