- fixed undefined behavior when grouping sections

The current group should not be accessed by reference because its container can be reallocated during iteration

https://forum.zdoom.org/viewtopic.php?t=62487
This commit is contained in:
alexey.lysiuk 2018-11-07 23:04:42 +02:00
parent 9ff7f338fd
commit ed72843dec

View file

@ -565,7 +565,7 @@ public:
// Don't use iterators here. These arrays are modified inside. // Don't use iterators here. These arrays are modified inside.
for (unsigned j = 0; j < build.Size(); j++) for (unsigned j = 0; j < build.Size(); j++)
{ {
auto &current = build[j]; auto current = build[j];
for (int i = 0; i < (int)workingSet.Size(); i++) for (int i = 0; i < (int)workingSet.Size(); i++)
{ {
// Are both sections close together? // Are both sections close together?