diff options
author | Simon Hafner <hafnersimon@gmail.com> | 2014-01-30 23:55:43 -0600 |
---|---|---|
committer | Simon Hafner <hafnersimon@gmail.com> | 2014-01-30 23:55:43 -0600 |
commit | e01fb17d023b046b3403a4413a637d24a9dc492f (patch) | |
tree | c28b802bb6eb52ce152367a728ab260526c69b19 /lib | |
parent | f070edb8b91d07bd4ac8fea82317b906cc5ec1c9 (diff) | |
download | Nim-e01fb17d023b046b3403a4413a637d24a9dc492f.tar.gz |
product more robust against empty input
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/algorithm.nim | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index b71b2c0fc..921c659de 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -148,6 +148,7 @@ proc product*[T](x: openarray[seq[T]]): seq[seq[T]] = var next: seq[T] = @[] next.setLen(x.len) for i in 0..(x.len-1): + if len(x[i]) == 0: return initial[i] = len(x[i])-1 indexes = initial while true: |