PartitionModule: skip nullptr devices, and report count

FIXES #686
This commit is contained in:
Adriaan de Groot 2017-06-14 12:21:02 -04:00 committed by Philip
parent 8823938c8f
commit b99fa43e6a

View File

@ -157,9 +157,9 @@ PartitionCoreModule::doInit()
// Remove the device which contains / from the list // Remove the device which contains / from the list
for ( QList< Device* >::iterator it = devices.begin(); it != devices.end(); ) for ( QList< Device* >::iterator it = devices.begin(); it != devices.end(); )
if ( *it && ( hasRootPartition( *it ) || if ( ! (*it) || hasRootPartition( *it ) ||
(*it)->deviceNode().startsWith( "/dev/zram") || (*it)->deviceNode().startsWith( "/dev/zram") ||
isIso9660( *it ) ) ) isIso9660( *it ) )
it = devices.erase( it ); it = devices.erase( it );
else else
++it; ++it;
@ -171,6 +171,7 @@ PartitionCoreModule::doInit()
m_deviceInfos << deviceInfo; m_deviceInfos << deviceInfo;
cDebug() << device->deviceNode() << device->capacity() << device->name() << device->prettyName(); cDebug() << device->deviceNode() << device->capacity() << device->name() << device->prettyName();
} }
cDebug() << ".." << devices.count() << "devices detected.";
m_deviceModel->init( devices ); m_deviceModel->init( devices );
// The following PartUtils::runOsprober call in turn calls PartUtils::canBeResized, // The following PartUtils::runOsprober call in turn calls PartUtils::canBeResized,