Ensure the glyph array is NULLed before use, and that we don't attempt to free NULL entries.

This commit is contained in:
Chris Young 2013-09-28 15:37:09 +01:00
parent 87da43d373
commit bd85c009d3
1 changed files with 3 additions and 1 deletions

View File

@ -318,6 +318,8 @@ void ami_menu_refresh(struct gui_window_2 *gwin)
static void ami_menu_load_glyphs(struct DrawInfo *dri) 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", menu_glyph[NSA_GLYPH_SUBMENU] = NewObject(NULL, "sysiclass",
SYSIA_Which, MENUSUB, SYSIA_Which, MENUSUB,
SYSIA_DrawInfo, dri, SYSIA_DrawInfo, dri,
@ -340,7 +342,7 @@ void ami_menu_free_glyphs(void)
if(menu_glyphs_loaded == false) return; if(menu_glyphs_loaded == false) return;
while(i < NSA_GLYPH_MAX) { while(i < NSA_GLYPH_MAX) {
DisposeObject(menu_glyph[i]); if(menu_glyph[i]) DisposeObject(menu_glyph[i]);
menu_glyph[i] = NULL; menu_glyph[i] = NULL;
}; };