Skip to content

Commit 998c1f0

Browse files
committed
Bug fixed: undesired behavior of the Copy method of CSVArrayList when the given end index exceeded the current amount of data in the instance.
1 parent 186b020 commit 998c1f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CSVArrayList.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,15 +978,15 @@ Attribute Copy.VB_Description = "Returns a copy of the current instance."
978978

979979
Set Copy = New CSVArrayList
980980
If Not P_INDEXING Then
981-
If endIndex = -1 Then
981+
If endIndex = -1 Or endIndex > CurrentIndex Then
982982
endIndex = CurrentIndex
983983
End If
984984
Copy.Reinitialize endIndex - startIndex + 1
985985
For c = startIndex To endIndex
986986
Copy.Add Buffer(c)
987987
Next c
988988
Else
989-
If endIndex = -1 Then
989+
If endIndex = -1 Or endIndex > IndexedCurrentIndex Then
990990
endIndex = IndexedCurrentIndex
991991
End If
992992
Copy.Reinitialize endIndex - startIndex + 1

0 commit comments

Comments
 (0)