Check menuobj before we dispose it

This commit is contained in:
Chris Young 2015-08-16 22:51:32 +01:00
parent b429a89ed6
commit 87ebe66880

View File

@ -517,19 +517,15 @@ void ami_free_menulabs(struct gui_window_2 *gwin)
{
int i;
for(i=0;i<=AMI_MENU_AREXX_MAX;i++)
{
if(gwin->menulab[i] && (gwin->menulab[i] != NM_BARLABEL))
{
if(gwin->menutype[i] & MENU_IMAGE)
{
DisposeObject(gwin->menuobj[i]);
for(i=0;i<=AMI_MENU_AREXX_MAX;i++) {
if(gwin->menulab[i] && (gwin->menulab[i] != NM_BARLABEL)) {
if(gwin->menutype[i] & MENU_IMAGE) {
if(gwin->menuobj[i]) DisposeObject(gwin->menuobj[i]);
}
ami_utf8_free(gwin->menulab[i]);
if(i >= AMI_MENU_AREXX)
{
if(i >= AMI_MENU_AREXX) {
if(gwin->menu_hook[i].h_Data) free(gwin->menu_hook[i].h_Data);
}
}