diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-05-06 02:17:04 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-05-06 02:17:04 +0000 |
commit | 2677886bc3f6460f3948f7a650b84c22ec8ba354 (patch) | |
tree | c0e07773a2dfcbae70c46aefbf932c2b5891c116 | |
parent | b2b3f39403e4e6a03d7e0a0bdd5679a1022bb740 (diff) | |
download | rockbox-2677886bc3f6460f3948f7a650b84c22ec8ba354.tar.gz rockbox-2677886bc3f6460f3948f7a650b84c22ec8ba354.zip |
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
-rw-r--r-- | apps/gui/quickscreen.c | 7 |
1 files changed, 7 insertions, 0 deletions
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, | |||
65 | int left_width, right_width, bottom_lines = 2; | 65 | int left_width, right_width, bottom_lines = 2; |
66 | unsigned char *s; | 66 | unsigned char *s; |
67 | int nb_lines = viewport_get_nb_lines(parent); | 67 | int nb_lines = viewport_get_nb_lines(parent); |
68 | |||
69 | /* nb_lines only returns the number of fully visible lines, small screens | ||
70 | or really large fonts could cause problems with the calculation below. | ||
71 | */ | ||
72 | if(nb_lines==0) | ||
73 | nb_lines++; | ||
74 | |||
68 | char_height = parent->height/nb_lines; | 75 | char_height = parent->height/nb_lines; |
69 | 76 | ||
70 | /* center the icons VP first */ | 77 | /* center the icons VP first */ |