diff --git a/source/common/sound/s_soundinternal.h b/source/common/sound/s_soundinternal.h index b978b3de6..30b73f139 100644 --- a/source/common/sound/s_soundinternal.h +++ b/source/common/sound/s_soundinternal.h @@ -380,10 +380,13 @@ public: template bool EnumerateChannels(func callback) { - for (FSoundChan* chan = Channels; chan; chan = chan->NextChan) + FSoundChan* chan = Channels; + while (chan) { + auto next = chan = chan->NextChan; int res = callback(chan); if (res) return res > 0; + chan = next; } return false; }