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:
@@ -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<int>(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<int>(m_fileHistory->GetCount()) )
|
||||
{
|
||||
DoOpenMRUFile(id - wxID_FILE1);
|
||||
|
||||
// Don't skip the event below.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxDocManager::DoOpenMRUFile(unsigned n)
|
||||
|
Reference in New Issue
Block a user