From: TimePath Date: Wed, 27 Jul 2016 12:14:53 +0000 (+1000) Subject: Loops: copy reference to next entity before entering lambda X-Git-Tag: xonotic-v0.8.2~700^2~18^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=abd4f23414e9e8d5dfa677f4b43de757b6954b3c;p=xonotic%2Fxonotic-data.pk3dir.git Loops: copy reference to next entity before entering lambda --- diff --git a/qcsrc/lib/iter.qh b/qcsrc/lib/iter.qh index c21d02121..82448b931 100644 --- a/qcsrc/lib/iter.qh +++ b/qcsrc/lib/iter.qh @@ -23,10 +23,11 @@ MACRO_BEGIN \ { \ int _i = 0; \ - for (entity _it = list##_first; _it; (_it = _it.next, ++_i)) \ + for (entity _it = list##_first, _next = NULL; _it; (_it = _next, ++_i)) \ { \ const noref int i = _i; \ ITER_CONST noref entity it = _it; \ + _next = _it.next; \ if (cond) { LAMBDA(body) } \ } \ } MACRO_END