From 8d01b9a6fddd0a7407b4ca0a777874e6edf5b0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Thu, 10 Jul 2014 15:14:06 +0200 Subject: [PATCH] assert-- --- src/modules/partition/CreatePartitionJob.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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() ); }