mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
PartitionModule: avoid nullptr crashes
Fix up iterator code so that it handles nullptr better. This avoids part of #686.
This commit is contained in:
parent
3677708d3e
commit
92a2c7aa70
2 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -83,6 +84,8 @@ PartitionIterator::operator!=( const PartitionIterator& other ) const
|
|||
PartitionIterator
|
||||
PartitionIterator::begin( Device* device )
|
||||
{
|
||||
if ( !device )
|
||||
return PartitionIterator( nullptr );
|
||||
Q_ASSERT(device);
|
||||
PartitionTable* table = device->partitionTable();
|
||||
if ( !table )
|
||||
|
@ -106,6 +109,8 @@ PartitionIterator::begin( PartitionTable* table )
|
|||
PartitionIterator
|
||||
PartitionIterator::end( Device* device )
|
||||
{
|
||||
if ( !device )
|
||||
return PartitionIterator( nullptr );
|
||||
PartitionTable* table = device->partitionTable();
|
||||
if ( !table )
|
||||
return PartitionIterator( nullptr );
|
||||
|
|
Loading…
Add table
Reference in a new issue