Skip to content

Commit 296f53a

Browse files
authored
Merge pull request #973 from tweksteen/fix_crash_drag_drop_timeline
Ignore invalid drop in timeline
2 parents 521cb00 + a36298b commit 296f53a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

common/lc_timelinewidget.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -562,19 +562,19 @@ void lcTimelineWidget::ItemSelectionChanged()
562562
void lcTimelineWidget::dropEvent(QDropEvent* Event)
563563
{
564564
QTreeWidgetItem* DropItem = itemAt(Event->pos());
565-
lcModel* Model = gMainWindow->GetActiveModel();
565+
566+
if (!DropItem)
567+
return;
566568

567569
QList<QTreeWidgetItem*> SelectedItems = selectedItems();
568570
clearSelection();
569571

570-
if (DropItem)
571-
{
572-
QTreeWidgetItem* ParentItem = DropItem->parent();
573-
lcStep Step = indexOfTopLevelItem(ParentItem ? ParentItem : DropItem) + 1;
572+
QTreeWidgetItem* ParentItem = DropItem->parent();
573+
lcStep Step = indexOfTopLevelItem(ParentItem ? ParentItem : DropItem) + 1;
574+
lcModel* Model = gMainWindow->GetActiveModel();
574575

575-
if (Step > Model->GetCurrentStep())
576-
Model->SetCurrentStep(Step);
577-
}
576+
if (Step > Model->GetCurrentStep())
577+
Model->SetCurrentStep(Step);
578578

579579
auto SortItems = [this](QTreeWidgetItem* Item1, QTreeWidgetItem* Item2)
580580
{

0 commit comments

Comments
 (0)