[partition] Complain loudly on dangling Partition pointers
- Don't crash if a bad pointer gets into colorutils.
This commit is contained in:
parent
2bc95d11d3
commit
353e713f81
@ -22,6 +22,8 @@
|
|||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
#include "core/PartitionIterator.h"
|
#include "core/PartitionIterator.h"
|
||||||
|
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
#include <kpmcore/core/partition.h>
|
#include <kpmcore/core/partition.h>
|
||||||
#include <kpmcore/fs/luks.h>
|
#include <kpmcore/fs/luks.h>
|
||||||
@ -81,6 +83,12 @@ _findRootForPartition( PartitionNode* partition )
|
|||||||
QColor
|
QColor
|
||||||
colorForPartition( Partition* partition )
|
colorForPartition( Partition* partition )
|
||||||
{
|
{
|
||||||
|
if ( !partition )
|
||||||
|
{
|
||||||
|
cWarning() << "NULL partition";
|
||||||
|
return FREE_SPACE_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
if ( KPMHelpers::isPartitionFreeSpace( partition ) )
|
if ( KPMHelpers::isPartitionFreeSpace( partition ) )
|
||||||
return FREE_SPACE_COLOR;
|
return FREE_SPACE_COLOR;
|
||||||
if ( partition->roles().has( PartitionRole::Extended ) )
|
if ( partition->roles().has( PartitionRole::Extended ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user