Browse Source

Return nothing gracefully if no sequence is provided

Alois Mahdal 3 years ago
parent
commit
d584e65b5e
1 changed files with 1 additions and 0 deletions
  1. 1
    0
      src/imapdomo.lua

+ 1
- 0
src/imapdomo.lua View File

@@ -207,6 +207,7 @@ pkg.head = function(num, seq)
207 207
     --
208 208
     -- Return first *num* elements from sequence
209 209
     --
210
+    if not seq then return seq end
210 211
     local result = seq:is_smaller(0)    -- HACK to generate empty sequence
211 212
     for idx, value in ipairs(seq) do
212 213
         if idx > num then break end