summaryrefslogtreecommitdiffstats
path: root/firmware/font.c
diff options
context:
space:
mode:
authorFred Bauer <fred.w.bauer@gmail.com>2011-09-27 01:02:34 +0000
committerFred Bauer <fred.w.bauer@gmail.com>2011-09-27 01:02:34 +0000
commit117ebdb28c74ca8c34e29f0450dcf06dcc0474c3 (patch)
treea880707ef1373fe9816f706401d4439f8408dfec /firmware/font.c
parentfe3eadffba810be2666435d68b929027130d47ed (diff)
downloadrockbox-117ebdb28c74ca8c34e29f0450dcf06dcc0474c3.tar.gz
rockbox-117ebdb28c74ca8c34e29f0450dcf06dcc0474c3.tar.bz2
rockbox-117ebdb28c74ca8c34e29f0450dcf06dcc0474c3.zip
Do not move NULL pointers in buflibmove_callback(). Fixes some skin crashes when changing themes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30610 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/font.c')
-rw-r--r--firmware/font.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/font.c b/firmware/font.c
index 2be90355db..e6f90e4ca5 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -93,8 +93,10 @@ static int buflibmove_callback(int handle, void* current, void* new)
if (alloc->handle_locked)
return BUFLIB_CB_CANNOT_MOVE;
- alloc->font.bits += diff;
- alloc->font.offset += diff;
+ if (alloc->font.bits)
+ alloc->font.bits += diff;
+ if (alloc->font.offset)
+ alloc->font.offset += diff;
if (alloc->font.width)
alloc->font.width += diff;
@@ -102,8 +104,10 @@ static int buflibmove_callback(int handle, void* current, void* new)
alloc->font.buffer_end += diff;
alloc->font.buffer_position += diff;
- alloc->font.cache._index += diff;
- alloc->font.cache._lru._base += diff;
+ if (alloc->font.cache._index)
+ alloc->font.cache._index += diff;
+ if (alloc->font.cache._lru._base)
+ alloc->font.cache._lru._base += diff;
return BUFLIB_CB_OK;
}