Skip to content

Commit 6a228aa

Browse files
authored
Handle empty menu when focusing item (#3742)
1 parent ea8d64a commit 6a228aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

archinstall/tui/menu_item.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ def focus_index(self, index: int) -> None:
274274
self.focus_item = enabled[index]
275275

276276
def focus_first(self) -> None:
277+
if len(self.items) == 0:
278+
return
279+
277280
first_item: MenuItem | None = self.items[0]
278281

279282
if first_item and not self._is_selectable(first_item):
@@ -283,6 +286,9 @@ def focus_first(self) -> None:
283286
self.focus_item = first_item
284287

285288
def focus_last(self) -> None:
289+
if len(self.items) == 0:
290+
return
291+
286292
last_item: MenuItem | None = self.items[-1]
287293

288294
if last_item and not self._is_selectable(last_item):

0 commit comments

Comments
 (0)