Guard against NULL m_fileHistory in wxDocManager::OnMRUFile().

Don't crash if wxDocManager was created with "initialize = false" ctor
argument in which case m_fileHistory remains false.

Closes #16973.
This commit is contained in:
Vadim Zeitlin
2015-04-29 14:06:48 +02:00
parent acc9d5db2f
commit 56b30625d0

View File

@@ -1147,17 +1147,21 @@ void wxDocManager::OnFileSaveAs(wxCommandEvent& WXUNUSED(event))
void wxDocManager::OnMRUFile(wxCommandEvent& event)
{
if ( m_fileHistory )
{
// 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<int>(m_fileHistory->GetCount()) )
{
DoOpenMRUFile(id - wxID_FILE1);
// Don't skip the event below.
return;
}
else
{
}
event.Skip();
}
}
void wxDocManager::DoOpenMRUFile(unsigned n)