diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-15 22:13:34 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-15 22:13:34 +0100 |
commit | 15631e24f740872c2be7cf81dd252c38b4aa174e (patch) | |
tree | 9df502d39652b992361c735cd02aa6eab32b702b /modules | |
parent | 6889889894e7c42ff3cd79fcd13da149e80c93ec (diff) | |
parent | 3684fd249e3f79c7c59d03a3ddcfc92407e94ed6 (diff) |
Merge pull request #70113 from adamscott/fix-crash-gdscript-from-variant
Fix `GDScript::_get_gdscript_from_variant()` crash
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 7 |
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); } |