diff --git a/src/sfizz/Voice.h b/src/sfizz/Voice.h index 6967e780..45802d2f 100644 --- a/src/sfizz/Voice.h +++ b/src/sfizz/Voice.h @@ -392,9 +392,11 @@ private: template void forEachWithSmoother(sfz::Mod modId, F&& lambda) { + size_t count = region->modifiers[modId].size(); + ASSERT(count == modifierSmoothers[modId].size()); auto mod = region->modifiers[modId].begin(); auto smoother = modifierSmoothers[modId].begin(); - while (mod < region->modifiers[modId].end()) { + for (size_t i = 0; i < count; ++i) { lambda(*mod, *smoother); incrementAll(mod, smoother); }