From e3d01cf25f9698962befe1a2ee485dd92fcb9ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sat, 9 Dec 2017 19:19:36 +0000 Subject: [PATCH] Do not attempt to set empty partition type. --- src/plugins/sfdisk/sfdiskpartitiontable.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/sfdisk/sfdiskpartitiontable.cpp b/src/plugins/sfdisk/sfdiskpartitiontable.cpp index 07f0686..1db421d 100644 --- a/src/plugins/sfdisk/sfdiskpartitiontable.cpp +++ b/src/plugins/sfdisk/sfdiskpartitiontable.cpp @@ -202,8 +202,11 @@ static QLatin1String getPartitionType(FileSystem::Type t, PartitionTable::TableT bool SfdiskPartitionTable::setPartitionSystemType(Report& report, const Partition& partition) { + QString partitionType = getPartitionType(partition.fileSystem().type(), m_device->partitionTable()->type()); + if (partitionType.isEmpty()) + return true; ExternalCommand sfdiskCommand(report, QStringLiteral("sfdisk"), { QStringLiteral("--part-type"), m_device->deviceNode(), QString::number(partition.number()), - getPartitionType(partition.fileSystem().type(), m_device->partitionTable()->type()) } ); + partitionType } ); return sfdiskCommand.run(-1) && sfdiskCommand.exitCode() == 0; }