From 3eb9dc8b4aa71ef4ea8a231ec4ea31a3b2c6e38d Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Mon, 17 May 2010 15:49:46 +0000 Subject: [PATCH] add assert and check if there is a selected partition svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1127769 --- src/gui/partitionmanagerwidget.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gui/partitionmanagerwidget.cpp b/src/gui/partitionmanagerwidget.cpp index 4fc2017..0f622e4 100644 --- a/src/gui/partitionmanagerwidget.cpp +++ b/src/gui/partitionmanagerwidget.cpp @@ -379,14 +379,23 @@ void PartitionManagerWidget::onPropertiesPartition() void PartitionManagerWidget::onMountPartition() { Partition* p = selectedPartition(); + + Q_ASSERT(p); + + if (p == NULL) + { + kWarning() << "no partition selected"; + return; + } + Report report(NULL); - if (p && p->canMount()) + if (p->canMount()) { if (!p->mount(report)) KMessageBox::detailedSorry(this, i18nc("@info", "The file system on partition %1 could not be mounted.", p->deviceNode()), QString("
%1
").arg(report.toText()), i18nc("@title:window", "Could Not Mount File System.")); } - else if (p && p->canUnmount()) + else if (p->canUnmount()) { if (!p->unmount(report)) KMessageBox::detailedSorry(this, i18nc("@info", "The file system on partition %1 could not be unmounted.", p->deviceNode()), QString("
%1
").arg(report.toText()), i18nc("@title:window", "Could Not Unmount File System."));