From bbfdf752834f9ae5ae74263a9805c91779fda91f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 12 Jan 2024 11:19:52 +0100 Subject: [PATCH] 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 --- qt-quick/chartview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qt-quick/chartview.cpp b/qt-quick/chartview.cpp index 1fb4e7607..46ed04753 100644 --- a/qt-quick/chartview.cpp +++ b/qt-quick/chartview.cpp @@ -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; }