diff --git a/src/apps/drivesetup/PartitionList.cpp b/src/apps/drivesetup/PartitionList.cpp index b2e2a60cc7..f711aa306f 100644 --- a/src/apps/drivesetup/PartitionList.cpp +++ b/src/apps/drivesetup/PartitionList.cpp @@ -288,7 +288,7 @@ PartitionListRow::DevicePath() = dynamic_cast(GetField(kDeviceColumn)); if (stringField == NULL) - return ""; + return NULL; return stringField->String(); } @@ -330,22 +330,22 @@ PartitionListView::InitiateDrag(BPoint rowPoint, bool wasSelected) { PartitionListRow* draggedRow = dynamic_cast(RowAt(rowPoint)); - if (draggedRow != NULL) { - BRect draggedRowRect; - GetRowRect(draggedRow, &draggedRowRect); + if (draggedRow == NULL) + return false; - const char* draggedPath = draggedRow->DevicePath(); - if (draggedPath != NULL) { - BMessage *drag = new BMessage(B_MIME_DATA); - drag->AddData("text/plain", B_MIME_TYPE, draggedPath, strlen(draggedPath)); + const char* draggedPath = draggedRow->DevicePath(); + if (draggedPath == NULL) + return false; - DragMessage(drag, draggedRowRect, NULL); + BRect draggedRowRect; + GetRowRect(draggedRow, &draggedRowRect); - return true; - } - } + BMessage dragMessage(B_MIME_DATA); + dragMessage.AddData("text/plain", B_MIME_TYPE, draggedPath, + strlen(draggedPath)); - return false; + DragMessage(&dragMessage, draggedRowRect, NULL); + return true; } diff --git a/src/apps/drivesetup/PartitionList.h b/src/apps/drivesetup/PartitionList.h index f4e504e03b..8ed7952025 100644 --- a/src/apps/drivesetup/PartitionList.h +++ b/src/apps/drivesetup/PartitionList.h @@ -79,6 +79,7 @@ public: { return fSize; } const char* DevicePath(); + private: partition_id fPartitionID; partition_id fParentID;