Merge pull request #283 from Ben-Alderson/master

Fix crash when removing the final child from LinearLayout when that child has focus
This commit is contained in:
Alexandre Bury 2018-08-26 12:21:38 -07:00 committed by GitHub
commit 8f6b37db00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)