Skip to content

Commit 86aac58

Browse files
committed
Validate negative startIndex in ObservableList.RemoveRange
Throw ArgumentOutOfRangeException before taking the lock, matching the existing count guard, so callers get a deterministic exception instead of an IndexOutOfRangeException from the per-item read at items[i] = _list[startIndex + i].
1 parent 1859014 commit 86aac58

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Runtime/Observable/ObservableList.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public void RemoveAt(int index)
168168

169169
public void RemoveRange(int startIndex, int count)
170170
{
171+
if (startIndex < 0) throw new ArgumentOutOfRangeException(nameof(startIndex));
171172
if (count < 0) throw new ArgumentOutOfRangeException(nameof(count));
172173

173174
lock (SyncRoot)

0 commit comments

Comments
 (0)