Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit fd21eeb

Browse files
committed
Fix crash on corrupted data in schedule
1 parent 72ee7b3 commit fd21eeb

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/ramobjectdelegates/ramscheduledelegate.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ QSet<RamStatus *> RamScheduleDelegate::getDueTasks(QModelIndex index) const
305305
i.next();
306306
if (i.value()->completionRatio() >= 100)
307307
tasks.remove(i.value());
308+
if (!i.value()->item())
309+
tasks.remove(i.value());
310+
if (!i.value()->step())
311+
tasks.remove(i.value());
308312
}
309313

310314
return tasks;

src/ramobjects/ramstatus.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,16 @@ QString RamStatus::name() const
546546
RamAbstractItem *item = this->item();
547547
RamStep *step = this->step();
548548
RamState *state = this->state();
549+
if (!item || !step) return "Unknwown Task";
550+
if (!state) return item->name() + " | " + step->name();
549551
return item->name() + " | " + step->name() + " | " + state->shortName();
550552
}
551553

552554
QString RamStatus::shortName() const
553555
{
554556
RamAbstractItem *item = this->item();
555557
RamStep *step = this->step();
558+
if (!item || !step) return "Task";
556559
return item->shortName() + " | " + step->shortName();
557560
}
558561

0 commit comments

Comments
 (0)