mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
88bcf045e3
commit
b167e130a4
1 changed files with 2 additions and 0 deletions
|
@ -235,11 +235,13 @@ void ChartView::ChartItemList::remove(ChartItem &item)
|
||||||
void ChartView::ChartItemList::append(ChartItem &item)
|
void ChartView::ChartItemList::append(ChartItem &item)
|
||||||
{
|
{
|
||||||
if (!first) {
|
if (!first) {
|
||||||
|
item.prev = nullptr;
|
||||||
first = &item;
|
first = &item;
|
||||||
} else {
|
} else {
|
||||||
item.prev = last;
|
item.prev = last;
|
||||||
last->next = &item;
|
last->next = &item;
|
||||||
}
|
}
|
||||||
|
item.next = nullptr;
|
||||||
last = &item;
|
last = &item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue