浏览代码

Merge pull request #2034 from tdaffin/f10crash

Fix a crash when pressing F10 on a window that has no main menu
Jumar Macato 7 年之前
父节点
当前提交
154a320046
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      src/Avalonia.Input/AccessKeyHandler.cs

+ 5 - 2
src/Avalonia.Input/AccessKeyHandler.cs

@@ -234,8 +234,11 @@ namespace Avalonia.Input
 
                 case Key.F10:
                     _owner.ShowAccessKeys = _showingAccessKeys = true;
-                    MainMenu.Open();
-                    e.Handled = true;
+                    if (MainMenu != null)
+                    {
+                        MainMenu.Open();
+                        e.Handled = true;
+                    }
                     break;
             }
         }