allow empty seqs

This commit is contained in:
Christian Ulrich 2020-10-12 21:33:05 +02:00
parent 492e5ee72f
commit 06465c93cd
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 3 additions and 4 deletions

View File

@ -27,9 +27,8 @@ proc parseField[S, T](input: string, output: var array[S, T]) =
proc parseField[T](input: string, output: var seq[T]) = proc parseField[T](input: string, output: var seq[T]) =
let parts = input.split(",") let parts = input.split(",")
if parts.len < 1:
raise newException(ValueError, "Sequence is empty")
output = newSeq[T](parts.len) output = newSeq[T](parts.len)
if parts.len > 0:
for i in 0 .. parts.len - 1: for i in 0 .. parts.len - 1:
parseField(parts[i], output[i]) parseField(parts[i], output[i])