diff --git a/common/lc_timelinewidget.cpp b/common/lc_timelinewidget.cpp index 882b05b8..32534df6 100644 --- a/common/lc_timelinewidget.cpp +++ b/common/lc_timelinewidget.cpp @@ -175,8 +175,10 @@ void lcTimelineWidget::Update(bool Clear) { if (PieceItemIndex >= StepItem->childCount() || PieceItem != StepItem->child(PieceItemIndex)) { - if (PieceItem->parent() == StepItem) - StepItem->removeChild(PieceItem); + QTreeWidgetItem* PieceParent = PieceItem->parent(); + + if (PieceParent) + PieceParent->removeChild(PieceItem); StepItem->insertChild(PieceItemIndex, PieceItem); }