diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-07-31 13:40:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-31 13:40:31 +0200 |
commit | 475592a3bc2d2150dcbd9179fff653e3c55505a1 (patch) | |
tree | f2b552feb9c2335706b07ff1c89955b3e4392ae8 | |
parent | 556cc22dd0d52e9cbf66f6bf3f664a47e42fdd3c (diff) | |
parent | f1ba63e09220274383e756b51cd6aac38e09647f (diff) | |
download | redot-engine-475592a3bc2d2150dcbd9179fff653e3c55505a1.tar.gz |
Merge pull request #54102 from skimmedsquare/line-edit-editor-settings-crash-45979
-rw-r--r-- | editor/editor_settings.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 37a531299f..4846fd6478 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -1051,6 +1051,8 @@ void EditorSettings::set_initial_value(const StringName &p_setting, const Varian } Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_restart_if_changed) { + ERR_FAIL_NULL_V_MSG(EditorSettings::get_singleton(), p_default, "EditorSettings not instantiated yet."); + Variant ret = p_default; if (EditorSettings::get_singleton()->has_setting(p_setting)) { ret = EditorSettings::get_singleton()->get(p_setting); @@ -1067,7 +1069,7 @@ Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default, bool p_re } Variant _EDITOR_GET(const String &p_setting) { - ERR_FAIL_COND_V(!EditorSettings::get_singleton()->has_setting(p_setting), Variant()); + ERR_FAIL_COND_V(!EditorSettings::get_singleton() || !EditorSettings::get_singleton()->has_setting(p_setting), Variant()); return EditorSettings::get_singleton()->get(p_setting); } @@ -1422,9 +1424,7 @@ void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) { } Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path) { - if (!EditorSettings::get_singleton()) { - return nullptr; - } + ERR_FAIL_NULL_V_MSG(EditorSettings::get_singleton(), nullptr, "EditorSettings not instantiated yet."); Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path); @@ -1434,6 +1434,8 @@ Ref<Shortcut> ED_GET_SHORTCUT(const String &p_path) { } void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_keycode) { + ERR_FAIL_NULL_MSG(EditorSettings::get_singleton(), "EditorSettings not instantiated yet."); + Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path); ERR_FAIL_COND_MSG(!sc.is_valid(), "Used ED_SHORTCUT_OVERRIDE with invalid shortcut: " + p_path + "."); @@ -1444,6 +1446,8 @@ void ED_SHORTCUT_OVERRIDE(const String &p_path, const String &p_feature, Key p_k } void ED_SHORTCUT_OVERRIDE_ARRAY(const String &p_path, const String &p_feature, const PackedInt32Array &p_keycodes) { + ERR_FAIL_NULL_MSG(EditorSettings::get_singleton(), "EditorSettings not instantiated yet."); + Ref<Shortcut> sc = EditorSettings::get_singleton()->get_shortcut(p_path); ERR_FAIL_COND_MSG(!sc.is_valid(), "Used ED_SHORTCUT_OVERRIDE_ARRAY with invalid shortcut: " + p_path + "."); |