summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-12-04 04:45:22 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-12-04 04:45:22 +0000
commitfce66cb83570e13a8494fd3d8dfc41b82e8512a0 (patch)
tree0cf4237a5b605bcc390c1e17367b2915bb57eec2
parent7a5eb3d08eb72f04a1c567eab021f562eeb6c521 (diff)
downloadrockbox-fce66cb83570e13a8494fd3d8dfc41b82e8512a0.tar.gz
rockbox-fce66cb83570e13a8494fd3d8dfc41b82e8512a0.zip
Dice: Prevent a divide by 0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23842 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/dice.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c
index ddbc0cc60e..bee9f89c6b 100644
--- a/apps/plugins/dice.c
+++ b/apps/plugins/dice.c
@@ -141,6 +141,9 @@ void dice_print(struct dices* dice, struct screen* display){
int display_nb_col=display->getwidth()/char_width;
int nb_dices_per_line=display_nb_col/4;/* 4 char per dice displayed*/
+ if(!nb_dices_per_line)
+ nb_dices_per_line++;
+
int nb_lines_required=dice->nb_dices/nb_dices_per_line;
int current_row=0;
if(dice->nb_dices%nb_dices_per_line!=0)