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;
if (newLength < 0) {
return self;
}
if (newLength < 0) return self;
if (storedObjects.length == newLength) return self;
for (i = newLength; i < storedObjects.length; i += 1) {
FreeItem(i);
}
if (storedObjects.length <= 0) {
storedObjects[0] = none;
}
storedObjects.length = newLength;
return self;
}

Loading…
Cancel
Save