[fractal: 1/2] (#431) Check vector length before accessing element
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal: 1/2] (#431) Check vector length before accessing element
- Date: Tue, 10 Dec 2019 07:25:13 +0000 (UTC)
commit 4bce11601cb4c1962a07a9b32fb4a9f42b83e89c
Author: Payson Wallach <paysonwallach icloud com>
Date: Thu Nov 14 22:44:14 2019 -0600
(#431) Check vector length before accessing element
fractal-gtk/src/app/connect/headerbar.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/fractal-gtk/src/app/connect/headerbar.rs b/fractal-gtk/src/app/connect/headerbar.rs
index dc815e47..f0088e46 100644
--- a/fractal-gtk/src/app/connect/headerbar.rs
+++ b/fractal-gtk/src/app/connect/headerbar.rs
@@ -25,7 +25,7 @@ impl App {
decor.splitn(2, ':').map(|s| s.to_string()).collect();
// Check if the close button is to the right; If not,
// change the headerbar controls
- if !decor_split[1].contains("close") {
+ if decor_split.len() > 1 && !decor_split[1].contains("close") {
right_header.set_show_close_button(false);
left_header.set_show_close_button(true);
}
@@ -37,7 +37,7 @@ impl App {
let decor_split: Vec<String> = decor.splitn(2,':').map(|s| s.to_string()).collect();
// Change the headerbar controls depending on position
// of close
- if !decor_split[1].contains("close") {
+ if decor_split.len() > 1 && !decor_split[1].contains("close") {
right_header.set_show_close_button(false);
left_header.set_show_close_button(true);
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]