From 2677886bc3f6460f3948f7a650b84c22ec8ba354 Mon Sep 17 00:00:00 2001 From: Karl Kurbjun Date: Wed, 6 May 2009 02:17:04 +0000 Subject: 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 --- apps/gui/quickscreen.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'apps') diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index 1ddae2390a..de0a0ba61a 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 */ -- cgit v1.2.3