recent_topics: Don't process hotkeys in empty table.

The fixes errors when we are trying process user input before
anything is initialized in recent topics.
This commit is contained in:
Aman Agrawal 2022-10-23 06:41:07 +00:00 committed by Tim Abbott
parent 2d31b52927
commit 5ee78fc14c
1 changed files with 5 additions and 0 deletions

View File

@ -1038,6 +1038,11 @@ export function change_focused_element($elt, input_key) {
return true;
}
} else if (is_table_focused()) {
// Don't process hotkeys in table if there are no rows.
if (!topics_widget || topics_widget.get_current_list().length === 0) {
return true;
}
// For arrowing around the table of topics, we implement left/right
// wraparound. Going off the top or the bottom takes one
// to the navigation at the top (see set_table_focus).