From b629eebe0fb941680e50c42a21bb5e4b2026a41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Tue, 22 Jul 2014 12:09:23 +0200 Subject: [PATCH] Improve error reports in setPartitionSystemType --- src/plugins/libparted/libpartedpartitiontable.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/libparted/libpartedpartitiontable.cpp b/src/plugins/libparted/libpartedpartitiontable.cpp index 5939dd2..6ac8e01 100644 --- a/src/plugins/libparted/libpartedpartitiontable.cpp +++ b/src/plugins/libparted/libpartedpartitiontable.cpp @@ -344,12 +344,18 @@ FileSystem::Type LibPartedPartitionTable::detectFileSystemBySector(Report& repor bool LibPartedPartitionTable::setPartitionSystemType(Report& report, const Partition& partition) { PedFileSystemType* pedFsType = (partition.roles().has(PartitionRole::Extended) || partition.fileSystem().type() == FileSystem::Unformatted) ? NULL : getPedFileSystemType(partition.fileSystem().type()); - - PedPartition* pedPartition = ped_disk_get_partition_by_sector(pedDisk(), partition.firstSector()); - - if (pedFsType == NULL || pedPartition == NULL) + if (pedFsType == NULL) { report.line() << xi18nc("@info/plain", "Could not update the system type for partition %1.", partition.deviceNode()); + report.line() << xi18nc("@info/plain", "No file system defined."); + return false; + } + + PedPartition* pedPartition = ped_disk_get_partition_by_sector(pedDisk(), partition.firstSector()); + if (pedPartition == NULL) + { + report.line() << xi18nc("@info/plain", "Could not update the system type for partition %1.", partition.deviceNode()); + report.line() << xi18nc("@info/plain", "No partition found at sector %1.", partition.firstSector()); return false; }