mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Prevent assert (and access violation) in wxWidgets.
(It directly dereferences the ArrayString with the FilterIndex, without bounds checking it.)
This commit is contained in:
parent
82fd8623eb
commit
238719184e
@ -142,7 +142,12 @@ bool GERBVIEW_FRAME::LoadFileOrShowDialog( const wxString& aFileName,
|
||||
|
||||
wxFileDialog dlg( this, dialogTitle, currentPath, filename.GetFullName(), dialogFiletypes,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE | wxFD_CHANGE_DIR );
|
||||
dlg.SetFilterIndex( lastGerberFileWildcard );
|
||||
|
||||
wxArrayString dummy1, dummy2;
|
||||
const int nWildcards = wxParseCommonDialogsFilter( dialogFiletypes, dummy1, dummy2 );
|
||||
|
||||
if( lastGerberFileWildcard >= 0 && lastGerberFileWildcard < nWildcards )
|
||||
dlg.SetFilterIndex( lastGerberFileWildcard );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return false;
|
||||
|
@ -114,6 +114,7 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
|
||||
}
|
||||
|
||||
wxString allWildcardsStr;
|
||||
|
||||
for( const wxString& wildcard : allWildcardsSet )
|
||||
allWildcardsStr << wildcard;
|
||||
|
||||
@ -123,7 +124,11 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::ImportFootprint( const wxString& aName )
|
||||
wxFileDialog dlg( this, _( "Import Footprint" ), m_mruPath, wxEmptyString, fileFiltersStr,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
dlg.SetFilterIndex( lastFilterIndex );
|
||||
wxArrayString dummy1, dummy2;
|
||||
const int nWildcards = wxParseCommonDialogsFilter( fileFiltersStr, dummy1, dummy2 );
|
||||
|
||||
if( lastFilterIndex >= 0 && lastFilterIndex < nWildcards )
|
||||
dlg.SetFilterIndex( lastFilterIndex );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user