From d64d97cb1751adb6bad7f5d6392eb433b1486fe8 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 19 Jan 2023 02:16:32 +0100 Subject: [PATCH] Fix Variant::can_convert[_strict] returning gibberish. An uninitialized value was being returned instead of the function return value. --- src/variant/variant.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/variant/variant.cpp b/src/variant/variant.cpp index 4026637c..1627367d 100644 --- a/src/variant/variant.cpp +++ b/src/variant/variant.cpp @@ -719,14 +719,12 @@ String Variant::get_type_name(Variant::Type type) { } bool Variant::can_convert(Variant::Type from, Variant::Type to) { - GDExtensionBool can; - internal::gde_interface->variant_can_convert(static_cast(from), static_cast(to)); + GDExtensionBool can = internal::gde_interface->variant_can_convert(static_cast(from), static_cast(to)); return PtrToArg::convert(&can); } bool Variant::can_convert_strict(Variant::Type from, Variant::Type to) { - GDExtensionBool can; - internal::gde_interface->variant_can_convert_strict(static_cast(from), static_cast(to)); + GDExtensionBool can = internal::gde_interface->variant_can_convert_strict(static_cast(from), static_cast(to)); return PtrToArg::convert(&can); }