fix bug in select-one! where nil result could not be returned

This commit is contained in:
Nathan Marz 2015-06-29 23:43:15 -04:00
parent da554d8247
commit 1f2b4f03de

View file

@ -37,9 +37,9 @@
(defn compiled-select-one!
"Version of select-one! that takes in a selector pre-compiled with comp-paths"
[selector structure]
(let [res (compiled-select-one selector structure)]
(when (nil? res) (throw-illegal "No elements found for params: " selector structure))
res
(let [res (compiled-select selector structure)]
(when (not= 1 (count res)) (throw-illegal "Expected exactly one element for params: " selector structure))
(first res)
))
(defn select-one!