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.
This commit is contained in:
Rémi Verschelde 2018-01-04 01:00:11 +01:00
parent e68965672d
commit d65ac7378c
4 changed files with 10 additions and 11 deletions

View file

@ -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 */