summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2011-10-05 11:44:22 +0000
committerBjörn Stenberg <bjorn@haxx.se>2011-10-05 11:44:22 +0000
commit725ed0ad3fd78b92746a31fed8e484208fb74b70 (patch)
tree9ce2c6e8c4bfa18c71f1c6782ba9e17dcd55a668 /firmware
parenta604345ae11bd7aae977c49bf6bb058f40b970a7 (diff)
downloadrockbox-725ed0ad3fd78b92746a31fed8e484208fb74b70.tar.gz
rockbox-725ed0ad3fd78b92746a31fed8e484208fb74b70.tar.bz2
rockbox-725ed0ad3fd78b92746a31fed8e484208fb74b70.zip
Only alloc if necessary. Patch by Jonathan Gordon.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30716 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/font.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/firmware/font.c b/firmware/font.c
index f00ff0e327..0546061a15 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -594,10 +594,13 @@ struct font* font_get(int font)
return &sysfont;
while (1) {
- struct buflib_alloc_data *alloc = core_get_data(buflib_allocations[font]);
- pf = &alloc->font;
- if (pf && pf->height)
- return pf;
+ if (buflib_allocations[font] > 0)
+ {
+ struct buflib_alloc_data *alloc = core_get_data(buflib_allocations[font]);
+ pf = &alloc->font;
+ if (pf && pf->height)
+ return pf;
+ }
if (--font < 0)
return &sysfont;
}