diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 8ce279593f..686b5bcbc9 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -1147,17 +1147,21 @@ void wxDocManager::OnFileSaveAs(wxCommandEvent& WXUNUSED(event)) void wxDocManager::OnMRUFile(wxCommandEvent& event) { - // Check if the id is in the range assigned to MRU list entries. - const int id = event.GetId(); - if ( id >= wxID_FILE1 && - id < wxID_FILE1 + static_cast(m_fileHistory->GetCount()) ) + if ( m_fileHistory ) { - DoOpenMRUFile(id - wxID_FILE1); - } - else - { - event.Skip(); + // Check if the id is in the range assigned to MRU list entries. + const int id = event.GetId(); + if ( id >= wxID_FILE1 && + id < wxID_FILE1 + static_cast(m_fileHistory->GetCount()) ) + { + DoOpenMRUFile(id - wxID_FILE1); + + // Don't skip the event below. + return; + } } + + event.Skip(); } void wxDocManager::DoOpenMRUFile(unsigned n)