summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorSimon Hafner <hafnersimon@gmail.com>2014-01-30 23:55:43 -0600
committerSimon Hafner <hafnersimon@gmail.com>2014-01-30 23:55:43 -0600
commite01fb17d023b046b3403a4413a637d24a9dc492f (patch)
treec28b802bb6eb52ce152367a728ab260526c69b19 /lib
parentf070edb8b91d07bd4ac8fea82317b906cc5ec1c9 (diff)
downloadNim-e01fb17d023b046b3403a4413a637d24a9dc492f.tar.gz
product more robust against empty input
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/algorithm.nim1
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: