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)
|
void wxDocManager::OnMRUFile(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
if ( m_fileHistory )
|
||||||
|
{
|
||||||
// Check if the id is in the range assigned to MRU list entries.
|
// Check if the id is in the range assigned to MRU list entries.
|
||||||
const int id = event.GetId();
|
const int id = event.GetId();
|
||||||
if ( id >= wxID_FILE1 &&
|
if ( id >= wxID_FILE1 &&
|
||||||
id < wxID_FILE1 + static_cast<int>(m_fileHistory->GetCount()) )
|
id < wxID_FILE1 + static_cast<int>(m_fileHistory->GetCount()) )
|
||||||
{
|
{
|
||||||
DoOpenMRUFile(id - wxID_FILE1);
|
DoOpenMRUFile(id - wxID_FILE1);
|
||||||
|
|
||||||
|
// Don't skip the event below.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDocManager::DoOpenMRUFile(unsigned n)
|
void wxDocManager::DoOpenMRUFile(unsigned n)
|
||||||
|
Reference in New Issue
Block a user