Script editor: Fix crash when root script is null
Bug introduced in #40746.
This commit is contained in:
parent
303515981b
commit
e016859c3b
|
@ -2094,12 +2094,12 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
|
||||||
// Don't open dominant script if using an external editor.
|
// Don't open dominant script if using an external editor.
|
||||||
const bool use_external_editor =
|
const bool use_external_editor =
|
||||||
EditorSettings::get_singleton()->get("text_editor/external/use_external_editor") ||
|
EditorSettings::get_singleton()->get("text_editor/external/use_external_editor") ||
|
||||||
script->get_language()->overrides_external_editor();
|
(script.is_valid() && script->get_language()->overrides_external_editor());
|
||||||
const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
||||||
|
|
||||||
const bool should_open = (open_dominant && !use_external_editor) || !EditorNode::get_singleton()->is_changing_scene();
|
const bool should_open = (open_dominant && !use_external_editor) || !EditorNode::get_singleton()->is_changing_scene();
|
||||||
|
|
||||||
if (script != nullptr && script->get_language()->overrides_external_editor()) {
|
if (script.is_valid() && script->get_language()->overrides_external_editor()) {
|
||||||
if (should_open) {
|
if (should_open) {
|
||||||
Error err = script->get_language()->open_in_external_editor(script, p_line >= 0 ? p_line : 0, p_col);
|
Error err = script->get_language()->open_in_external_editor(script, p_line >= 0 ? p_line : 0, p_col);
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
|
@ -3005,7 +3005,7 @@ void ScriptEditor::set_scene_root_script(Ref<Script> p_script) {
|
||||||
// Don't open dominant script if using an external editor.
|
// Don't open dominant script if using an external editor.
|
||||||
const bool use_external_editor =
|
const bool use_external_editor =
|
||||||
EditorSettings::get_singleton()->get("text_editor/external/use_external_editor") ||
|
EditorSettings::get_singleton()->get("text_editor/external/use_external_editor") ||
|
||||||
p_script->get_language()->overrides_external_editor();
|
(p_script.is_valid() && p_script->get_language()->overrides_external_editor());
|
||||||
const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
const bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
||||||
|
|
||||||
if (open_dominant && !use_external_editor && p_script.is_valid()) {
|
if (open_dominant && !use_external_editor && p_script.is_valid()) {
|
||||||
|
|
Loading…
Reference in New Issue