From 660056045c2747b6e036db3431e3cc2073dcb861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Szab=C3=B3?= Date: Thu, 22 Jul 2021 04:05:57 +0200 Subject: [PATCH] Fix cloning of B/B tracks (#6077) Co-authored-by: Spekular --- src/gui/editors/BBEditor.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/editors/BBEditor.cpp b/src/gui/editors/BBEditor.cpp index f40d30bda..0cb898028 100644 --- a/src/gui/editors/BBEditor.cpp +++ b/src/gui/editors/BBEditor.cpp @@ -326,11 +326,15 @@ void BBTrackContainerView::clonePattern() BBTrack *bbt = BBTrack::findBBTrack(cur_bb); - // Clone the track - Track *newTrack = bbt->clone(); + if( bbt ) + { + // Clone the track + Track *newTrack = bbt->clone(); + bbtc->setCurrentBB( static_cast( newTrack )->index() ); - // Track still have the TCOs which is undesirable in this case, clear the track - newTrack->lock(); - newTrack->deleteTCOs(); - newTrack->unlock(); + // Track still have the TCOs which is undesirable in this case, clear the track + newTrack->lock(); + newTrack->deleteTCOs(); + newTrack->unlock(); + } }