diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 6b0f60e..6b969d1 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -373,8 +373,8 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b } else { /* ... and lastly if it won't, enable the scroll bar and fit the * list in below the widget */ - int avg_height = list_height / (int)list->Length(); - int rows = (screen_bottom - 4 - top) / avg_height; + int avg_height = list_height / max((int)list->Length(), 1); + int rows = (screen_bottom - 4 - top) / max(avg_height, 1); height = rows * avg_height; scroll = true; /* Add space for the scroll bar if we automatically determined