Fix crash when removing a child from LinearLayout when final child has focus

This commit is contained in:
Ben-Alderson 2018-08-26 14:56:08 -04:00
parent 92f919978c
commit fe93b945fd

View File

@ -192,7 +192,7 @@ impl LinearLayout {
if i < self.children.len() { if i < self.children.len() {
self.invalidate(); self.invalidate();
if self.focus > i { if self.focus > i || (self.focus != 0 && self.focus == self.children.len() - 1) {
self.focus -= 1; self.focus -= 1;
} }
Some(self.children.remove(i).view) Some(self.children.remove(i).view)