diff options
| author | Andrey Orst <andreyorst@gmail.com> | 2020-11-21 21:22:42 +0300 |
|---|---|---|
| committer | Andrey Orst <andreyorst@gmail.com> | 2020-11-21 21:22:42 +0300 |
| commit | 015206974763b55e971276727a923a4eb5757f21 (patch) | |
| tree | 0c9a03e5011332962ac9229ca95172f42f7c3aad | |
| parent | 644fedfa61ad2372cc3b99e0ba18962433340a42 (diff) | |
fix(macros): prevent nil in ipairs
| -rw-r--r-- | cljlib-macros.fnl | 4 |
1 files 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 |