From c2b59773af525161d4dd3f1dd9baac179f1afda9 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 22 Nov 2018 23:41:33 +0200 Subject: [PATCH] Fix NULL pointer dereferencing on uninstantiated Ref() conversion to Variant --- src/core/Variant.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/Variant.cpp b/src/core/Variant.cpp index 8519cebc..4f88951b 100644 --- a/src/core/Variant.cpp +++ b/src/core/Variant.cpp @@ -142,7 +142,10 @@ Variant::Variant(const RID& p_rid) Variant::Variant(const Object* p_object) { - godot::api->godot_variant_new_object(&_godot_variant, p_object->_owner); + if (p_object) + godot::api->godot_variant_new_object(&_godot_variant, p_object->_owner); + else + godot::api->godot_variant_new_nil(&_godot_variant); } Variant::Variant(const Dictionary& p_dictionary)