summaryrefslogtreecommitdiff
path: root/apps/gui/quickscreen.c
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-05-06 02:17:04 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-05-06 02:17:04 +0000
commit2677886bc3f6460f3948f7a650b84c22ec8ba354 (patch)
treec0e07773a2dfcbae70c46aefbf932c2b5891c116 /apps/gui/quickscreen.c
parentb2b3f39403e4e6a03d7e0a0bdd5679a1022bb740 (diff)
downloadrockbox-2677886bc3f6460f3948f7a650b84c22ec8ba354.zip
rockbox-2677886bc3f6460f3948f7a650b84c22ec8ba354.tar.gz
rockbox-2677886bc3f6460f3948f7a650b84c22ec8ba354.tar.bz2
rockbox-2677886bc3f6460f3948f7a650b84c22ec8ba354.tar.xz
Keep the quickscreen from crashing the player with a divide by 0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20854 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/quickscreen.c')
-rw-r--r--apps/gui/quickscreen.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index 1ddae23..de0a0ba 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -65,6 +65,13 @@ static void quickscreen_fix_viewports(struct gui_quickscreen *qs,
int left_width, right_width, bottom_lines = 2;
unsigned char *s;
int nb_lines = viewport_get_nb_lines(parent);
+
+ /* nb_lines only returns the number of fully visible lines, small screens
+ or really large fonts could cause problems with the calculation below.
+ */
+ if(nb_lines==0)
+ nb_lines++;
+
char_height = parent->height/nb_lines;
/* center the icons VP first */