From af1788baf3f34edee419078afb0d448251711822 Mon Sep 17 00:00:00 2001 From: Sergey Minakov Date: Sun, 21 Jun 2020 16:52:03 +0300 Subject: [PATCH] Variant: Fix potential crash when stringifying deleted Object Fixes #38597. --- core/variant.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/variant.cpp b/core/variant.cpp index 13ff2bfbdaf..94be8b6d43d 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1598,6 +1598,10 @@ String Variant::stringify(List &stack) const { Object *obj = _OBJ_PTR(*this); if (obj) { + if (_get_obj().ref.is_null() && !ObjectDB::get_instance(obj->get_instance_id())) { + return "[Deleted Object]"; + } + return obj->to_string(); } else { #ifdef DEBUG_ENABLED