allow empty seqs
This commit is contained in:
parent
492e5ee72f
commit
06465c93cd
|
@ -27,11 +27,10 @@ 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)
|
||||||
for i in 0 .. parts.len - 1:
|
if parts.len > 0:
|
||||||
parseField(parts[i], output[i])
|
for i in 0 .. parts.len - 1:
|
||||||
|
parseField(parts[i], output[i])
|
||||||
|
|
||||||
proc parseField[T: tuple | object](input: string, output: var T) =
|
proc parseField[T: tuple | object](input: string, output: var T) =
|
||||||
var fieldCount = 0
|
var fieldCount = 0
|
||||||
|
|
Loading…
Reference in New Issue