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
This commit is contained in:
Fred Bauer 2011-09-27 01:02:34 +00:00
parent fe3eadffba
commit 117ebdb28c
1 changed files with 8 additions and 4 deletions

View File

@ -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;
}