diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 2619ed876b2..29ff0c6b480 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -505,9 +505,11 @@ void ProgramMemoryState::removeModifiedVars(const Token* tok) { const ProgramMemory& pm = state; auto eval = [&](const Token* cond) -> std::vector { - if (conditionIsTrue(cond, pm, *settings)) + ProgramMemory pm2 = pm; + auto result = execute(cond, pm2, *settings); + if (isTrue(result)) return {1}; - if (conditionIsFalse(cond, pm, *settings)) + if (isFalse(result)) return {0}; return {}; };