Fixes #5501 null pointer exception in AtlasUI on Windows.

Contrary to wxWidgets documentation, wxMenuEvent::GetMenu() can return
NULL when the system menu is accessed on wxMSW, see
https://trac.wxwidgets.org/ticket/18443.

This was SVN commit r22467.
This commit is contained in:
historic_bruno 2019-07-14 05:02:43 +00:00
parent 7300dd186e
commit 80d9a44ab5

View File

@ -997,6 +997,11 @@ void ScenarioEditor::OnHelp(wxCommandEvent& event)
void ScenarioEditor::OnMenuOpen(wxMenuEvent& event)
{
// This could be done far more elegantly if wxMenuItem had changeable id.
// Ignore wxMSW system menu events, see https://trac.wildfiregames.com/ticket/5501
wxMenu* menu = event.GetMenu();
if (!menu)
return;
wxMenu* pasteMenuItem = NULL;
event.GetMenu()->FindItem(ID_Paste, &pasteMenuItem);