1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Handle null URL in panelSelectionDidChange() call

Thanks Renéfor reporting it.
This commit is contained in:
Leland Lucius 2020-04-01 14:16:52 -05:00
parent 2be1cd8867
commit 577d526ec8

View File

@ -153,6 +153,7 @@ void FileDialog::Create(
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard, const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
long style, const wxPoint& pos, const wxSize& sz, const wxString& name) long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
{ {
FileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name); FileDialogBase::Create(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name);
// m_sheetDelegate = [[ModalDialogDelegate alloc] init]; // m_sheetDelegate = [[ModalDialogDelegate alloc] init];
@ -300,7 +301,7 @@ void FileDialog::DoViewResized(void* object)
void FileDialog::DoSendFolderChangedEvent(void* panel, const wxString & path) void FileDialog::DoSendFolderChangedEvent(void* panel, const wxString & path)
{ {
m_dir = wxPathOnly( path ); m_dir = path;
wxFileCtrlEvent event( wxEVT_FILECTRL_FOLDERCHANGED, this, GetId() ); wxFileCtrlEvent event( wxEVT_FILECTRL_FOLDERCHANGED, this, GetId() );
@ -315,13 +316,16 @@ void FileDialog::DoSendSelectionChangedEvent(void* panel)
{ {
NSSavePanel* sPanel = (NSSavePanel*) panel; NSSavePanel* sPanel = (NSSavePanel*) panel;
NSString* path = [[sPanel URL] path]; NSString* path = [[sPanel URL] path];
wxFileName fn(wxCFStringRef::AsStringWithNormalizationFormC( path ));
m_path = wxCFStringRef::AsStringWithNormalizationFormC( path ); if (!fn.GetFullPath().empty())
m_fileName = wxFileNameFromPath( m_path ); {
m_dir = wxPathOnly( m_path ); m_path = fn.GetFullPath();
m_dir = fn.GetPath();
m_fileName = fn.GetFullName();
m_fileNames.Clear(); m_fileNames.Clear();
m_fileNames.Add( m_fileName ); m_fileNames.Add( m_fileName );
} }
}
else else
{ {
NSOpenPanel* oPanel = (NSOpenPanel*) panel; NSOpenPanel* oPanel = (NSOpenPanel*) panel;