From c43a23cea8c20391c79a17ad5b594291841e6279 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sun, 4 Jun 2023 17:07:18 +0200 Subject: [PATCH] Fix: crash when not even a single row fits for dropdowns on low resolution screens (#10934) --- src/widgets/dropdown.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index f6e50e5ad2..6ffbfc1bd6 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -385,11 +385,8 @@ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button scroll = true; uint avg_height = height / (uint)list.size(); - /* Check at least there is space for one item. */ - assert(available_height >= avg_height); - - /* Fit the list. */ - uint rows = available_height / avg_height; + /* Fit the list; create at least one row, even if there is no height available. */ + uint rows = std::max(available_height / avg_height, 1); height = rows * avg_height; /* Add space for the scrollbar. */