First check, then assert.
This commit is contained in:
parent
ab049467b7
commit
504ac5a86c
|
@ -64,11 +64,11 @@ RestoreOperation::RestoreOperation(Device& d, Partition* p, const QString& filen
|
||||||
|
|
||||||
Partition* dest = targetDevice().partitionTable()->findPartitionBySector(restorePartition().firstSector(), PartitionRole(PartitionRole::Primary | PartitionRole::Logical | PartitionRole::Unallocated));
|
Partition* dest = targetDevice().partitionTable()->findPartitionBySector(restorePartition().firstSector(), PartitionRole(PartitionRole::Primary | PartitionRole::Logical | PartitionRole::Unallocated));
|
||||||
|
|
||||||
Q_ASSERT(dest);
|
|
||||||
|
|
||||||
if (dest == nullptr)
|
if (dest == nullptr)
|
||||||
qWarning() << "destination partition not found at sector " << restorePartition().firstSector();
|
qWarning() << "destination partition not found at sector " << restorePartition().firstSector();
|
||||||
|
|
||||||
|
Q_ASSERT(dest);
|
||||||
|
|
||||||
if (dest && !dest->roles().has(PartitionRole::Unallocated)) {
|
if (dest && !dest->roles().has(PartitionRole::Unallocated)) {
|
||||||
restorePartition().setLastSector(dest->lastSector());
|
restorePartition().setLastSector(dest->lastSector());
|
||||||
setOverwrittenPartition(dest);
|
setOverwrittenPartition(dest);
|
||||||
|
|
Loading…
Reference in New Issue