mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Merge pull request #70113 from adamscott/fix-crash-gdscript-from-variant
Fix `GDScript::_get_gdscript_from_variant()` crash
This commit is contained in:
commit
15631e24f7
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user