qt-quick: initialize prev and next when adding chart items

The code assumed that when adding chart items to lists, prev
and next are initialized to null. Make this more robust.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-01-12 11:19:52 +01:00
parent 88bcf045e3
commit b167e130a4

View file

@ -235,11 +235,13 @@ void ChartView::ChartItemList::remove(ChartItem &item)
void ChartView::ChartItemList::append(ChartItem &item)
{
if (!first) {
item.prev = nullptr;
first = &item;
} else {
item.prev = last;
last->next = &item;
}
item.next = nullptr;
last = &item;
}