summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gdscript/gdscript.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 91f31174dd..258f1a80f7 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -1288,15 +1288,10 @@ String GDScript::_get_gdscript_reference_class_name(const GDScript *p_gdscript)
}
GDScript *GDScript::_get_gdscript_from_variant(const Variant &p_variant) {
- Variant::Type type = p_variant.get_type();
- if (type != Variant::Type::OBJECT)
- return nullptr;
-
Object *obj = p_variant;
- if (obj == nullptr) {
+ if (obj == nullptr || obj->get_instance_id().is_null()) {
return nullptr;
}
-
return Object::cast_to<GDScript>(obj);
}