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:
parent
e68965672d
commit
d65ac7378c
|
@ -298,7 +298,7 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
|
||||||
args.push_back(0);
|
args.push_back(0);
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
if (p_path.find("/")) {
|
if (p_path.find("/") != -1) {
|
||||||
// exec name contains path so use it
|
// exec name contains path so use it
|
||||||
execv(p_path.utf8().get_data(), &args[0]);
|
execv(p_path.utf8().get_data(), &args[0]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4423,7 +4423,7 @@ void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) {
|
||||||
for (int i = 0; i < p_files.size(); i++) {
|
for (int i = 0; i < p_files.size(); i++) {
|
||||||
|
|
||||||
String from = p_files[i];
|
String from = p_files[i];
|
||||||
if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) < 0)) {
|
if (!ResourceFormatImporter::get_singleton()->can_be_imported(from) && (just_copy.find(from.get_extension().to_lower()) != -1)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String to = to_path.plus_file(from.get_file());
|
String to = to_path.plus_file(from.get_file());
|
||||||
|
|
|
@ -232,7 +232,7 @@ void ScriptCreateDialog::_lang_changed(int l) {
|
||||||
String path = file_path->get_text();
|
String path = file_path->get_text();
|
||||||
String extension = "";
|
String extension = "";
|
||||||
if (path != "") {
|
if (path != "") {
|
||||||
if (path.find(".") >= 0) {
|
if (path.find(".") != -1) {
|
||||||
extension = path.get_extension();
|
extension = path.get_extension();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,6 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.find("/") || p.find("\\")) {
|
|
||||||
DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||||
if (d->change_dir(p.get_base_dir()) != OK) {
|
if (d->change_dir(p.get_base_dir()) != OK) {
|
||||||
_msg_path_valid(false, TTR("Invalid base path"));
|
_msg_path_valid(false, TTR("Invalid base path"));
|
||||||
|
@ -368,7 +367,6 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memdelete(d);
|
memdelete(d);
|
||||||
}
|
|
||||||
|
|
||||||
/* Does file already exist */
|
/* Does file already exist */
|
||||||
|
|
||||||
|
|
|
@ -209,6 +209,7 @@ Color ColorPicker::get_pick_color() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorPicker::add_preset(const Color &p_color) {
|
void ColorPicker::add_preset(const Color &p_color) {
|
||||||
|
|
||||||
if (presets.find(p_color)) {
|
if (presets.find(p_color)) {
|
||||||
presets.move_to_back(presets.find(p_color));
|
presets.move_to_back(presets.find(p_color));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue