< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_MenuBar.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -204,11 +204,14 @@
 /**
  * If the menu changes after the system has created the window,
  * this function must be called to draw the changed menu bar.
  */
 void AwtMenuBar::RedrawMenuBar() {
-    VERIFY(::DrawMenuBar(GetOwnerHWnd()));
+    HWND hOwnerWnd = GetOwnerHWnd();
+    if (hOwnerWnd != NULL) {
+        VERIFY(::DrawMenuBar(hOwnerWnd));
+    }
 }
 
 void AwtMenuBar::_AddMenu(void *param)
 {
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
< prev index next >