Browse Source

Fix some bugs with dynamic array allocation

core_refactor
Anton Tarasenko 2 years ago
parent
commit
56933914fa
  1. 9
      sources/Data/Collections/ArrayList.uc

9
sources/Data/Collections/ArrayList.uc

@ -96,12 +96,15 @@ public final function ArrayList SetLength(int newLength)
{ {
local int i; local int i;
if (newLength < 0) { if (newLength < 0) return self;
return self; if (storedObjects.length == newLength) return self;
}
for (i = newLength; i < storedObjects.length; i += 1) { for (i = newLength; i < storedObjects.length; i += 1) {
FreeItem(i); FreeItem(i);
} }
if (storedObjects.length <= 0) {
storedObjects[0] = none;
}
storedObjects.length = newLength; storedObjects.length = newLength;
return self; return self;
} }

Loading…
Cancel
Save