checking for NULL
This commit is contained in:
parent
9e64b18495
commit
fdf8e348df
@ -324,6 +324,9 @@ bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) {
|
|||||||
void menuEntryParseIcon(menuEntry_s* me) {
|
void menuEntryParseIcon(menuEntry_s* me) {
|
||||||
size_t imagesize = 256*256*3;
|
size_t imagesize = 256*256*3;
|
||||||
unsigned char *imageptr = (unsigned char*)malloc(imagesize);//imageptr cannot be null
|
unsigned char *imageptr = (unsigned char*)malloc(imagesize);//imageptr cannot be null
|
||||||
|
|
||||||
|
if (imageptr == NULL) return;
|
||||||
|
|
||||||
me->icon_gfx = (uint8_t*)imageptr;
|
me->icon_gfx = (uint8_t*)imageptr;
|
||||||
int w,h,samp;
|
int w,h,samp;
|
||||||
|
|
||||||
@ -342,7 +345,7 @@ void menuEntryParseIcon(menuEntry_s* me) {
|
|||||||
free(me->icon);
|
free(me->icon);
|
||||||
me->icon = NULL;
|
me->icon = NULL;
|
||||||
|
|
||||||
if (imageptr[0] == 0) return;
|
|
||||||
|
|
||||||
me->icon_gfx = (uint8_t*)malloc(imagesize);
|
me->icon_gfx = (uint8_t*)malloc(imagesize);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user