PartitionModule: avoid nullptr crashes

Fix up iterator code so that it handles nullptr better.
This avoids part of #686.
This commit is contained in:
Adriaan de Groot 2017-06-14 11:39:53 -04:00
parent 3677708d3e
commit 92a2c7aa70
2 changed files with 7 additions and 2 deletions

View file

@ -157,9 +157,9 @@ PartitionCoreModule::doInit()
// Remove the device which contains / from the list
for ( QList< Device* >::iterator it = devices.begin(); it != devices.end(); )
if ( hasRootPartition( *it ) ||
if ( *it && ( hasRootPartition( *it ) ||
(*it)->deviceNode().startsWith( "/dev/zram") ||
isIso9660( *it ) )
isIso9660( *it ) ) )
it = devices.erase( it );
else
++it;