From 3d0709c779be330ae3259dff9a80c431b944f3c2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 31 Aug 2021 13:46:25 +0200 Subject: [PATCH] [partition] Avoid crash when there is no KPM backend --- src/modules/partition/core/DeviceList.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp index 6b770a982..c7de12e88 100644 --- a/src/modules/partition/core/DeviceList.cpp +++ b/src/modules/partition/core/DeviceList.cpp @@ -112,6 +112,11 @@ QList< Device* > getDevices( DeviceType which ) { CoreBackend* backend = CoreBackendManager::self()->backend(); + if ( !backend ) + { + cWarning() << "No KPM backend found."; + return {}; + } #if defined( WITH_KPMCORE4API ) DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag( 0 ) ); #else