summaryrefslogtreecommitdiff
path: root/editor/editor_autoload_settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_autoload_settings.cpp')
-rw-r--r--editor/editor_autoload_settings.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index a7975c86c5..7210211d90 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -81,7 +81,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
if (Variant::get_type_name(Variant::Type(i)) == p_name) {
if (r_error)
- *r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing buit-in type name.");
+ *r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing built-in type name.");
return false;
}
@@ -545,10 +545,7 @@ bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Varia
int section = tree->get_drop_section_at_position(p_point);
- if (section < -1)
- return false;
-
- return true;
+ return section >= -1;
}
return false;
@@ -650,7 +647,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
return false;
}
- String path = p_path;
+ const String &path = p_path;
if (!FileAccess::exists(path)) {
EditorNode::get_singleton()->show_warning(TTR("Invalid path.") + "\n" + TTR("File does not exist."));
return false;
@@ -663,7 +660,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_
name = "autoload/" + name;
- UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *undo_redo = EditorNode::get_undo_redo();
undo_redo->create_action(TTR("Add AutoLoad"));
// Singleton autoloads are represented with a leading "*" in their path.
@@ -690,7 +687,7 @@ void EditorAutoloadSettings::autoload_remove(const String &p_name) {
String name = "autoload/" + p_name;
- UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
+ UndoRedo *undo_redo = EditorNode::get_undo_redo();
int order = ProjectSettings::get_singleton()->get_order(name);
@@ -789,7 +786,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
}
}
- if (!info.is_singleton && !info.in_editor) {
+ if (!info.is_singleton && !info.in_editor && info.node != NULL) {
memdelete(info.node);
info.node = NULL;
}