1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-16 16:20:50 +02:00

Protect against not having an initial file type selected

This commit is contained in:
Leland Lucius 2015-08-16 03:13:55 -05:00
parent 09c8a739f7
commit 141c42bbdb

View File

@ -337,6 +337,11 @@ void FileDialog::ShowWindowModal()
void FileDialog::DoOnFilterSelected(int index) void FileDialog::DoOnFilterSelected(int index)
{ {
if (index == wxNOT_FOUND)
{
return;
}
NSArray* types = GetTypesFromExtension(m_filterExtensions[index],m_currentExtensions); NSArray* types = GetTypesFromExtension(m_filterExtensions[index],m_currentExtensions);
NSSavePanel* panel = (NSSavePanel*) GetWXWindow(); NSSavePanel* panel = (NSSavePanel*) GetWXWindow();
[panel setAllowedFileTypes:types]; [panel setAllowedFileTypes:types];
@ -551,13 +556,15 @@ int FileDialog::ShowModal()
m_useFileTypeFilter = m_filterExtensions.GetCount() > 0; m_useFileTypeFilter = m_filterExtensions.GetCount() > 0;
#if defined(we_always_want_the_types)
if( HasFlag(wxFD_OPEN) ) if( HasFlag(wxFD_OPEN) )
{ {
if ( !(wxSystemOptions::HasOption( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES ) && (wxSystemOptions::GetOptionInt( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES ) == 1)) ) if ( !(wxSystemOptions::HasOption( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES ) && (wxSystemOptions::GetOptionInt( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES ) == 1)) )
m_useFileTypeFilter = false; m_useFileTypeFilter = false;
} }
#endif
m_firstFileTypeFilter = -1; m_firstFileTypeFilter = wxNOT_FOUND;
if ( m_useFileTypeFilter if ( m_useFileTypeFilter
&& m_filterIndex >= 0 && m_filterIndex < m_filterExtensions.GetCount() ) && m_filterIndex >= 0 && m_filterIndex < m_filterExtensions.GetCount() )