io/router: don't panic on focus moves when there is nothing to focus

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-04-05 13:12:03 +02:00
parent f07537335a
commit 69f982e26f
2 changed files with 8 additions and 0 deletions
+3
View File
@@ -171,6 +171,9 @@ func (q *keyQueue) updateFocusLayout() {
// MoveFocus attempts to move the focus in the direction of dir, returning true if it succeeds.
func (q *keyQueue) MoveFocus(dir FocusDirection, events *handlerEvents) bool {
if len(q.dirOrder) == 0 {
return false
}
order := 0
if q.focus != nil {
order = q.handlers[q.focus].dirOrder