summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2020-08-04 23:06:47 +0200
committerGitHub <noreply@github.com>2020-08-04 23:06:47 +0200
commitaca1f28e1f873655f51628933136f7c4a1230334 (patch)
tree4c75d60dfdf361be4e2542eb9b9669c0e8b3b5c9
parentcd7c3e0f29862e6eda3b378dd5096f7d1695a708 (diff)
parent093356539bd63cca1b480f644cfac0b34b1b5d8c (diff)
Merge pull request #2992 from ywwg/clone-deck-crash
Fix missing nullptr check.
-rw-r--r--src/engine/sync/enginesync.h4
-rw-r--r--src/mixer/basetrackplayer.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/engine/sync/enginesync.h b/src/engine/sync/enginesync.h
index 8374d81155..29fc05ff2b 100644
--- a/src/engine/sync/enginesync.h
+++ b/src/engine/sync/enginesync.h
@@ -52,11 +52,13 @@ class EngineSync : public BaseSyncableListener {
void notifyScratching(Syncable* pSyncable, bool scratching) override;
// Used to pick a sync target for cases where master sync mode is not sufficient.
- // Guaranteed to pick a Syncable that is a real deck and has an EngineBuffer.
+ // Guaranteed to pick a Syncable that is a real deck and has an EngineBuffer,
+ // but can return nullptr if there are no choices.
// First choice is master sync, if it's a real deck,
// then it will fall back to the first playing syncable deck,
// then it will fall back to the first playing deck,
// then it will fall back to the first non-playing deck.
+ // If there is literally nothing loaded, returns nullptr.
Syncable* pickNonSyncSyncTarget(EngineChannel* pDontPick) const;
// Used to test whether changing the rate of a Syncable would change the rate
diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp
index 2058d66d6a..ebd7b70fd3 100644
--- a/src/mixer/basetrackplayer.cpp
+++ b/src/mixer/basetrackplayer.cpp
@@ -525,7 +525,9 @@ TrackPointer BaseTrackPlayerImpl::getLoadedTrack() const {
void BaseTrackPlayerImpl::slotCloneDeck() {
Syncable* syncable = m_pEngineMaster->getEngineSync()->pickNonSyncSyncTarget(m_pChannel);
- slotCloneChannel(syncable->getChannel());
+ if (syncable) {
+ slotCloneChannel(syncable->getChannel());
+ }
}
void BaseTrackPlayerImpl::slotCloneFromGroup(const QString& group) {