Skip to content

Commit

Permalink
fix: prevent null CO access when cloning sampler or preview
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Oct 8, 2024
1 parent 4bb5cb7 commit 85335a5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/engine/channels/enginedeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "engine/enginevumeter.h"
#include "moc_enginedeck.cpp"
#include "track/track.h"
#include "util/assert.h"
#include "util/sample.h"

#ifdef __STEM__
Expand Down Expand Up @@ -206,6 +207,18 @@ void EngineDeck::cloneStemState(const EngineDeck* deckToClone) {
VERIFY_OR_DEBUG_ASSERT(deckToClone) {
return;
}
// Sampler and preview decks don't have stem controls
if ((m_stemGain.empty() && m_stemMute.empty()) ||
(deckToClone->m_stemGain.empty() &&
deckToClone->m_stemMute.empty())) {
return;
}
VERIFY_OR_DEBUG_ASSERT(m_stemGain.size() == kMaxSupportedStems &&
m_stemMute.size() == kMaxSupportedStems &&
deckToClone->m_stemGain.size() == kMaxSupportedStems &&
deckToClone->m_stemMute.size() == kMaxSupportedStems) {
return;
}
for (int stemIdx = 0; stemIdx < kMaxSupportedStems; stemIdx++) {
m_stemGain[stemIdx]->set(deckToClone->m_stemGain[stemIdx]->get());
m_stemMute[stemIdx]->set(deckToClone->m_stemMute[stemIdx]->get());
Expand Down

0 comments on commit 85335a5

Please sign in to comment.