First check, then assert. Also fix check syntax.
This commit is contained in:
parent
ac6591807a
commit
ab049467b7
|
@ -256,7 +256,7 @@ Partition* createUnallocated(const Device& device, PartitionNode& parent, qint64
|
||||||
*/
|
*/
|
||||||
void PartitionTable::removeUnallocated(PartitionNode* p)
|
void PartitionTable::removeUnallocated(PartitionNode* p)
|
||||||
{
|
{
|
||||||
Q_ASSERT(p != nullptr);
|
Q_ASSERT(p);
|
||||||
|
|
||||||
qint32 i = 0;
|
qint32 i = 0;
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ void PartitionTable::removeUnallocated()
|
||||||
*/
|
*/
|
||||||
void PartitionTable::insertUnallocated(const Device& d, PartitionNode* p, qint64 start) const
|
void PartitionTable::insertUnallocated(const Device& d, PartitionNode* p, qint64 start) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(p != nullptr);
|
Q_ASSERT(p);
|
||||||
|
|
||||||
qint64 lastEnd = start;
|
qint64 lastEnd = start;
|
||||||
|
|
||||||
|
@ -317,8 +317,8 @@ void PartitionTable::insertUnallocated(const Device& d, PartitionNode* p, qint64
|
||||||
|
|
||||||
if (!p->isRoot()) {
|
if (!p->isRoot()) {
|
||||||
Partition* extended = dynamic_cast<Partition*>(p);
|
Partition* extended = dynamic_cast<Partition*>(p);
|
||||||
Q_ASSERT(extended != nullptr);
|
parentEnd = extended ? extended->lastSector() : -1;
|
||||||
parentEnd = (extended != nullptr) ? extended->lastSector() : -1;
|
Q_ASSERT(extended);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parentEnd >= firstUsable())
|
if (parentEnd >= firstUsable())
|
||||||
|
|
Loading…
Reference in New Issue