From bd85c009d3359f85ed5dd8211d797707b29af9cb Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 28 Sep 2013 15:37:09 +0100 Subject: [PATCH] Ensure the glyph array is NULLed before use, and that we don't attempt to free NULL entries. --- amiga/menu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/amiga/menu.c b/amiga/menu.c index e75e03791..9d47cbdf4 100644 --- a/amiga/menu.c +++ b/amiga/menu.c @@ -318,6 +318,8 @@ void ami_menu_refresh(struct gui_window_2 *gwin) static void ami_menu_load_glyphs(struct DrawInfo *dri) { + while(i < NSA_GLYPH_MAX) menu_glyph[i] = NULL; + menu_glyph[NSA_GLYPH_SUBMENU] = NewObject(NULL, "sysiclass", SYSIA_Which, MENUSUB, SYSIA_DrawInfo, dri, @@ -340,7 +342,7 @@ void ami_menu_free_glyphs(void) if(menu_glyphs_loaded == false) return; while(i < NSA_GLYPH_MAX) { - DisposeObject(menu_glyph[i]); + if(menu_glyph[i]) DisposeObject(menu_glyph[i]); menu_glyph[i] = NULL; };