mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Backport r31075 to avoid freezes on invalid font ids
git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_10@31076 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cc16c1070a
commit
5bc2945fde
1 changed files with 4 additions and 2 deletions
|
@ -127,7 +127,7 @@ static void lock_font_handle(int handle, bool lock)
|
|||
|
||||
void font_lock(int font_id, bool lock)
|
||||
{
|
||||
if( font_id == FONT_SYSFIXED )
|
||||
if( font_id < 0 || font_id >= MAXFONTS )
|
||||
return;
|
||||
if( buflib_allocations[font_id] >= 0 )
|
||||
lock_font_handle(buflib_allocations[font_id], lock);
|
||||
|
@ -484,6 +484,8 @@ static int alloc_and_init(int font_idx, const char* name, size_t size)
|
|||
|
||||
const char* font_filename(int font_id)
|
||||
{
|
||||
if ( font_id < 0 || font_id >= MAXFONTS )
|
||||
return NULL;
|
||||
int handle = buflib_allocations[font_id];
|
||||
if (handle > 0)
|
||||
return core_get_name(handle);
|
||||
|
@ -578,7 +580,7 @@ int font_load(const char *path)
|
|||
|
||||
void font_unload(int font_id)
|
||||
{
|
||||
if ( font_id == FONT_SYSFIXED )
|
||||
if ( font_id < 0 || font_id >= MAXFONTS )
|
||||
return;
|
||||
int handle = buflib_allocations[font_id];
|
||||
if ( handle < 0 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue