]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dnd.cpp
cleanup - reformatting
[wxWidgets.git] / src / mac / carbon / dnd.cpp
index dac1bb95ef290a96beb48c865da86033d509b55a..f5212eb4e210e5d007c82f947b17abe3975bcc48 100644 (file)
@@ -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<wxFileDataObject*>(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
                         {