diff --git a/src/modules/partition/CreatePartitionJob.cpp b/src/modules/partition/CreatePartitionJob.cpp index 0f18323ad..ce8cb590b 100644 --- a/src/modules/partition/CreatePartitionJob.cpp +++ b/src/modules/partition/CreatePartitionJob.cpp @@ -51,19 +51,32 @@ Calamares::JobResult CreatePartitionJob::exec() { Report report( 0 ); + QString message = tr( "The installer failed to create partition on %1." ).arg( m_device->name() ); CoreBackend* backend = CoreBackendManager::self()->backend(); QScopedPointer backendDevice( backend->openDevice( m_device->deviceNode() ) ); - Q_ASSERT( backendDevice.data() ); + if ( !backendDevice.data() ) + { + return Calamares::JobResult::error( + message, + tr( "Could not open device %1." ).arg( m_device->deviceNode() ) + ); + } QScopedPointer backendPartitionTable( backendDevice->openPartitionTable() ); - Q_ASSERT( backendPartitionTable ); + if ( !backendPartitionTable.data() ) + { + return Calamares::JobResult::error( + message, + tr( "Could not open partition table." ) + ); + } QString partitionPath = backendPartitionTable->createPartition( report, *m_partition ); if ( partitionPath.isEmpty() ) { return Calamares::JobResult::error( - tr( "The installer failed to create partition on %1." ).arg( m_device->name() ), + message, report.toText() ); }