From f50ee5bb5aa153c49e32791079c3c7fbaacab222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Sat, 17 Sep 2022 00:51:34 +0900 Subject: [PATCH] Fix crash when trying to display the menu in a tiny window --- src/terminal_ui.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/terminal_ui.cc b/src/terminal_ui.cc index a20d27ee..b788dbe8 100644 --- a/src/terminal_ui.cc +++ b/src/terminal_ui.cc @@ -1073,6 +1073,9 @@ void TerminalUI::menu_show(ConstArrayView items, const LineCount height = is_search ? 1 : (min(max_height, div_round_up(item_count, m_menu.columns))); + if (height == 0) + return; + const ColumnCount maxlen = (m_menu.columns > 1 and item_count > 1) ? max_width / m_menu.columns - 1 : max_width;