From 015206974763b55e971276727a923a4eb5757f21 Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Sat, 21 Nov 2020 21:22:42 +0300 Subject: fix(macros): prevent nil in ipairs --- cljlib-macros.fnl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cljlib-macros.fnl b/cljlib-macros.fnl index 7b2bf49..7b94f85 100644 --- a/cljlib-macros.fnl +++ b/cljlib-macros.fnl @@ -703,7 +703,7 @@ at runtime: res# (match to-type# ;; Sequence or empty table (seq1# ? (or (= seq1# :seq) (= seq1# :empty))) - (do (each [_# v# (ipairs (seq# from#))] + (do (each [_# v# (ipairs (seq# (or from# [])))] (insert# to# v#)) to#) ;; associative table @@ -719,7 +719,7 @@ at runtime: :else (error "expected table as second argument" 2)) ;; set both ordered set and hash set (Set# ? (or (= Set# :cljlib/ordered-set) (= Set# :cljlib/hash-set))) - (do (each [_# v# (ipairs (seq# from#))] + (do (each [_# v# (ipairs (seq# (or from# [])))] (tset to# v# v#)) to#) ;; sometimes it is handy to pass nil too -- cgit v1.2.3