summaryrefslogtreecommitdiffstats
path: root/editor/project_settings_editor.cpp
diff options
context:
space:
mode:
authorMarcel Admiraal <madmiraal@users.noreply.github.com>2021-12-28 17:08:06 +0000
committerMarcel Admiraal <madmiraal@users.noreply.github.com>2022-01-12 15:19:18 +0000
commit5737e7dd2dac03e04d1c17cb1f4afedc956b48e2 (patch)
tree8d0e19610961b4d22a5e7557a8eb55fe33044ab7 /editor/project_settings_editor.cpp
parenta7839df8698058ae207929d7542ef75a0954104b (diff)
downloadredot-engine-5737e7dd2dac03e04d1c17cb1f4afedc956b48e2.tar.gz
Check if action name exists before adding it or renaming an action to it
Diffstat (limited to 'editor/project_settings_editor.cpp')
-rw-r--r--editor/project_settings_editor.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index b710eb2546..1bf6243bcc 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -275,10 +275,8 @@ void ProjectSettingsEditor::_editor_restart_close() {
void ProjectSettingsEditor::_action_added(const String &p_name) {
String name = "input/" + p_name;
- if (ProjectSettings::get_singleton()->has_setting(name)) {
- action_map->show_message(vformat(TTR("An action with the name '%s' already exists."), name));
- return;
- }
+ ERR_FAIL_COND_MSG(ProjectSettings::get_singleton()->has_setting(name),
+ "An action with this name already exists.");
Dictionary action;
action["events"] = Array();
@@ -351,10 +349,8 @@ void ProjectSettingsEditor::_action_renamed(const String &p_old_name, const Stri
const String old_property_name = "input/" + p_old_name;
const String new_property_name = "input/" + p_new_name;
- if (ProjectSettings::get_singleton()->has_setting(new_property_name)) {
- action_map->show_message(vformat(TTR("An action with the name '%s' already exists."), new_property_name));
- return;
- }
+ ERR_FAIL_COND_MSG(ProjectSettings::get_singleton()->has_setting(new_property_name),
+ "An action with this name already exists.");
int order = ProjectSettings::get_singleton()->get_order(old_property_name);
Dictionary action = ProjectSettings::get_singleton()->get(old_property_name);