diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-19 08:25:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-19 08:25:18 +0100 |
commit | c3440c71f7e81303d4af12080953e7129294ad23 (patch) | |
tree | 84fddcc5f22c6327f9295c3bce4f19c43cff02aa /editor/create_dialog.cpp | |
parent | 719762d4dcbbb102e3ca2c3e1b635be295b2bd94 (diff) | |
parent | 639c4b6f20975c47da74d0dbd669314c5cd721c1 (diff) |
Merge pull request #58306 from timothyqiu/create-node
Fix crash in Create New Node dialog with certain user-created scripts
Diffstat (limited to 'editor/create_dialog.cpp')
-rw-r--r-- | editor/create_dialog.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 081f0ac868..7e59fc31c4 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -235,19 +235,19 @@ void CreateDialog::_add_type(const String &p_type, const TypeCategory p_type_cat } } else { if (ScriptServer::is_global_class(p_type)) { - inherits = EditorNode::get_editor_data().script_class_get_base(p_type); - if (inherits.is_empty()) { - Ref<Script> script = EditorNode::get_editor_data().script_class_load_script(p_type); - ERR_FAIL_COND(script.is_null()); + Ref<Script> script = EditorNode::get_editor_data().script_class_load_script(p_type); + ERR_FAIL_COND(script.is_null()); - Ref<Script> base = script->get_base_script(); - if (base.is_null()) { - String extends; - script->get_language()->get_global_class_name(script->get_path(), &extends); + Ref<Script> base = script->get_base_script(); + if (base.is_null()) { + String extends; + script->get_language()->get_global_class_name(script->get_path(), &extends); - inherits = extends; - inherited_type = TypeCategory::CPP_TYPE; - } else { + inherits = extends; + inherited_type = TypeCategory::CPP_TYPE; + } else { + inherits = script->get_language()->get_global_class_name(base->get_path()); + if (inherits.is_empty()) { inherits = base->get_path(); inherited_type = TypeCategory::PATH_TYPE; } |