diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-01-04 01:00:11 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2018-01-04 01:20:20 +0100 |
commit | d65ac7378c77648124e0e8acd09cea8fd0d104cd (patch) | |
tree | 635e19e3e146f2deddeedff7528f1f5b16bc6cac /editor/script_create_dialog.cpp | |
parent | e68965672df8e06a1a6c977d3426b001a0767a9a (diff) | |
download | redot-engine-d65ac7378c77648124e0e8acd09cea8fd0d104cd.tar.gz |
Fix crash in OS::execute on FreeBSD
As spotted by @robfram, closes #15288.
Also reviewed other uses of `if (String.find(.*))` for potential similar mistakes, found a wrong (and useless) one in ScriptEditorDialog.
Diffstat (limited to 'editor/script_create_dialog.cpp')
-rw-r--r-- | editor/script_create_dialog.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index ad6ea2180f..96863a59d2 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -232,7 +232,7 @@ void ScriptCreateDialog::_lang_changed(int l) { String path = file_path->get_text(); String extension = ""; if (path != "") { - if (path.find(".") >= 0) { + if (path.find(".") != -1) { extension = path.get_extension(); } @@ -359,16 +359,14 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { return; } - if (p.find("/") || p.find("\\")) { - DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); - if (d->change_dir(p.get_base_dir()) != OK) { - _msg_path_valid(false, TTR("Invalid base path")); - memdelete(d); - _update_dialog(); - return; - } + DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); + if (d->change_dir(p.get_base_dir()) != OK) { + _msg_path_valid(false, TTR("Invalid base path")); memdelete(d); + _update_dialog(); + return; } + memdelete(d); /* Does file already exist */ |