From c448c5cf53c538ac5d5a09a2e7d6e12e460ec648 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Sun, 13 Feb 2000 15:05:07 +0000 Subject: [PATCH] Check that ci->hWindowMenu is not zero before using it. --- windows/mdi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/windows/mdi.c b/windows/mdi.c index 1a81e6d6eb6..40489764e89 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -3,7 +3,8 @@ * Copyright 1994, Bob Amstadt * 1995,1996 Alex Korobka * - * This file contains routines to support MDI features. + * This file contains routines to support MDI (Multiple Document + * Interface) features . * * Notes: Fairly complete implementation. Any volunteers for * "More windows..." stuff? @@ -342,7 +343,8 @@ static HWND MDICreateChild( WND *w, MDICLIENTINFO *ci, HWND parent, } /* this menu is needed to set a check mark in MDI_ChildActivate */ - AppendMenuA(ci->hWindowMenu ,MF_STRING ,wIDmenu, lpstrDef ); + if (ci->hWindowMenu != 0) + AppendMenuA(ci->hWindowMenu ,MF_STRING ,wIDmenu, lpstrDef ); ci->nActiveChildren++; @@ -1116,7 +1118,8 @@ LRESULT WINAPI MDIClientWndProc( HWND hwnd, UINT message, WPARAM wParam, } MDI_UpdateFrameText(frameWnd, hwnd, MDI_NOFRAMEREPAINT,frameWnd->text); - AppendMenuA( ci->hWindowMenu, MF_SEPARATOR, 0, NULL ); + if (ci->hWindowMenu != 0) + AppendMenuA( ci->hWindowMenu, MF_SEPARATOR, 0, NULL ); GetClientRect(frameWnd->hwndSelf, &rect); NC_HandleNCCalcSize( w, &rect ); @@ -1131,7 +1134,8 @@ LRESULT WINAPI MDIClientWndProc( HWND hwnd, UINT message, WPARAM wParam, case WM_DESTROY: if( ci->hwndChildMaximized ) MDI_RestoreFrameMenu(w->parent, ci->hwndChildMaximized); - if((nItems = GetMenuItemCount(ci->hWindowMenu)) > 0) + if((ci->hWindowMenu != 0) && + (nItems = GetMenuItemCount(ci->hWindowMenu)) > 0) { ci->idFirstChild = nItems - 1; ci->nActiveChildren++; /* to delete a separator */