From f6eb565ea3c1dc0248fd14c1fb8f5eea54b4bac3 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 4 Jun 2016 17:21:18 +0200 Subject: [PATCH] avoid division by zero --- src/gui/bookmarkmanager.cpp | 6 ++++-- src/gui/timerlist.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 92b4dd1e8..94fe00bfb 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -469,8 +469,10 @@ void CBookmarkManager::paint() int ypos = y+ theight; int sb = 2*fheight* listmaxshow; frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); - - int sbc= ((bookmarks.size()- 1)/ listmaxshow)+ 1; + unsigned int tmp_max = listmaxshow; + if(!tmp_max) + tmp_max = 1; + int sbc= ((bookmarks.size()- 1)/ tmp_max)+ 1; if (sbc < 1) sbc = 1; diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index e695a5a0f..fb8927463 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -881,8 +881,10 @@ void CTimerList::paint() int ypos = y+ theight; int sb = 2*fheight* listmaxshow; frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); - - int sbc= ((timerlist.size()- 1)/ listmaxshow)+ 1; + unsigned int tmp_max = listmaxshow; + if(!tmp_max) + tmp_max = 1; + int sbc= ((timerlist.size()- 1)/ tmp_max)+ 1; frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ page_nr * (sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3, RADIUS_SMALL); }