- filebrowser: fix total_pages calculation for CComponentsScrollBar

This commit is contained in:
vanhofen
2017-06-06 16:08:29 +02:00
committed by M. Liebmann
parent a79a96efd6
commit 628e8ea3e4

View File

@@ -1472,7 +1472,7 @@ void CFileBrowser::paint()
paintItem(count); paintItem(count);
//scrollbar //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); int current_page = (selected / listmaxshow);
paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page);