Skip to content

Commit 8a93f2d

Browse files
merktjrsjbailey
authored andcommitted
Add if-case to getEnvelopeBypassed function to check for env != nullptr.
1 parent aaea607 commit 8a93f2d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

reaper-adm-extension/src/reaper_adm/exportaction_admsource-earvst.cpp

+13-12
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ void EarVstExportSources::generateAdmAndChna(ReaperAPI const& api)
201201
for (auto& newError : newErrors) {
202202
warningStrings.push_back(newError.what());
203203
}
204-
}
205-
else if(param && env) {
204+
} else if(param && env) {
206205
// We have an envelope for this ADM parameter
207206
auto newErrors = cumulatedPointData.useEnvelopeDataForParameter(*env, *param, admParameter, api);
208207
for(auto &newError : newErrors) {
@@ -367,16 +366,18 @@ std::optional<double> EarVstExportSources::getValueFor(std::shared_ptr<admplug::
367366
bool EarVstExportSources::getEnvelopeBypassed(TrackEnvelope* env, ReaperAPI const& api)
368367
{
369368
bool envBypassed = false;
370-
char chunk[1024]; // For a plugin parameter (PARMENV) the ACT flag should always be within the first couple bytes of the state chunk
371-
bool getRes = api.GetEnvelopeStateChunk(env, chunk, 1024, false);
372-
if (getRes) {
373-
std::istringstream chunkSs(chunk);
374-
std::string line;
375-
while (std::getline(chunkSs, line)) {
376-
auto activePos = line.rfind("ACT ", 0);
377-
if ((activePos != std::string::npos) && (line.size() > (activePos + 4))) {
378-
envBypassed = line.at(activePos + 4) == '0';
379-
break;
369+
if(env) {
370+
char chunk[1024]; // For a plugin parameter (PARMENV) the ACT flag should always be within the first couple bytes of the state chunk
371+
bool getRes = api.GetEnvelopeStateChunk(env, chunk, 1024, false);
372+
if (getRes) {
373+
std::istringstream chunkSs(chunk);
374+
std::string line;
375+
while (std::getline(chunkSs, line)) {
376+
auto activePos = line.rfind("ACT ", 0);
377+
if ((activePos != std::string::npos) && (line.size() > (activePos + 4))) {
378+
envBypassed = line.at(activePos + 4) == '0';
379+
break;
380+
}
380381
}
381382
}
382383
}

0 commit comments

Comments
 (0)