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(); + } }