From 628e8ea3e4b1e66a115190defbc12efa1a587d57 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 6 Jun 2017 16:08:29 +0200 Subject: [PATCH] - filebrowser: fix total_pages calculation for CComponentsScrollBar --- src/gui/filebrowser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 444bb313b..6e877060d 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1472,7 +1472,7 @@ void CFileBrowser::paint() paintItem(count); //scrollbar - int total_pages = ((filelist.size() - 1) / listmaxshow) + 1; + int total_pages = filelist.size() == 0 ? 1 : ((filelist.size() - 1) / listmaxshow) + 1; int current_page = (selected / listmaxshow); paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page);