From fdf8e348df0190b97a0a52be485378e95e434866 Mon Sep 17 00:00:00 2001 From: NightlyFox Date: Sat, 29 Sep 2018 16:26:59 -0500 Subject: [PATCH] checking for NULL --- common/menu-entry.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/menu-entry.c b/common/menu-entry.c index effb74a..0a60970 100644 --- a/common/menu-entry.c +++ b/common/menu-entry.c @@ -324,6 +324,9 @@ bool menuEntryLoad(menuEntry_s* me, const char* name, bool shortcut) { void menuEntryParseIcon(menuEntry_s* me) { size_t imagesize = 256*256*3; unsigned char *imageptr = (unsigned char*)malloc(imagesize);//imageptr cannot be null + + if (imageptr == NULL) return; + me->icon_gfx = (uint8_t*)imageptr; int w,h,samp; @@ -342,7 +345,7 @@ void menuEntryParseIcon(menuEntry_s* me) { free(me->icon); me->icon = NULL; - if (imageptr[0] == 0) return; + me->icon_gfx = (uint8_t*)malloc(imagesize);