From fe93b945fd6d31f02a06365cad63aa6efa37bc22 Mon Sep 17 00:00:00 2001 From: Ben-Alderson Date: Sun, 26 Aug 2018 14:56:08 -0400 Subject: [PATCH] Fix crash when removing a child from LinearLayout when final child has focus --- src/views/linear_layout.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/linear_layout.rs b/src/views/linear_layout.rs index ac5e192..7720b51 100644 --- a/src/views/linear_layout.rs +++ b/src/views/linear_layout.rs @@ -192,7 +192,7 @@ impl LinearLayout { if i < self.children.len() { self.invalidate(); - if self.focus > i { + if self.focus > i || (self.focus != 0 && self.focus == self.children.len() - 1) { self.focus -= 1; } Some(self.children.remove(i).view)