fix: Fixes PooledRefList ToList returning wrong size (#1899)
### Summary - Fixed a bug caused by a bad assumption. If `m_List[index]` is sparse and null values are casted, the server does not crash. - Fixed a bug where `PooledRefList.ToList` extension method returned the wrong list size.
This commit is contained in:
parent
a6a647551f
commit
5d9d1a2118
2 changed files with 6 additions and 3 deletions
|
|
@ -419,7 +419,7 @@ public static class Utility
|
|||
// This requires copying the List, which is an O(n) operation.
|
||||
public static List<R> ToList<T, R>(this PooledRefList<T> poolList) where T : R
|
||||
{
|
||||
var size = poolList._size;
|
||||
var size = poolList.Count;
|
||||
var items = poolList._items;
|
||||
|
||||
var list = new List<R>(size);
|
||||
|
|
@ -428,7 +428,7 @@ public static class Utility
|
|||
return list;
|
||||
}
|
||||
|
||||
for (var i = 0; i < items.Length; i++)
|
||||
for (var i = 0; i < size; i++)
|
||||
{
|
||||
list.Add(items[i]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue