X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf473da729e2be34f890d8b9c9af4a4143f1647b..7af14d718783cb81233e7f45f9f61159ad420b79:/src/mac/carbon/dnd.cpp diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index dac1bb95ef..f5212eb4e2 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -245,26 +245,34 @@ bool wxDropTarget::GetData() theData[dataSize] = 0 ; m_dataObject->SetData( wxDataFormat(wxDF_TEXT), dataSize , theData ); } - #if wxUSE_UNICODE +#if wxUSE_UNICODE else if ( theType == kScrapFlavorTypeUnicode ) { theData[dataSize + 0] = theData[dataSize + 1] = 0 ; m_dataObject->SetData( wxDataFormat(wxDF_UNICODETEXT), dataSize , theData ); } - #endif +#endif else if ( theType == kDragFlavorTypeHFS ) { - HFSFlavor* theFile = (HFSFlavor*) theData ; - wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ; - if ( !firstFileAdded ) + wxFileDataObject *fdo = dynamic_cast(m_dataObject); + wxASSERT( fdo != NULL ); + + if ((theData != NULL) && (fdo != NULL)) { - // reset file list - ((wxFileDataObject*)m_dataObject)->SetData( 0 , "" ) ; - firstFileAdded = true ; + HFSFlavor* theFile = (HFSFlavor*) theData ; + wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ; + + if ( !firstFileAdded ) + { + // reset file list + fdo->SetData( 0 , "" ) ; + firstFileAdded = true ; + } + + if (!name.IsEmpty()) + fdo->AddFile( name ) ; } - - ((wxFileDataObject*)m_dataObject)->AddFile( name ) ; } else {