From 1f2b4f03defb0669df1a7cfb05441322034b2aef Mon Sep 17 00:00:00 2001 From: Nathan Marz Date: Mon, 29 Jun 2015 23:43:15 -0400 Subject: [PATCH] fix bug in select-one! where nil result could not be returned --- src/clj/com/rpl/specter.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/clj/com/rpl/specter.clj b/src/clj/com/rpl/specter.clj index 8bcb504..8056e7f 100644 --- a/src/clj/com/rpl/specter.clj +++ b/src/clj/com/rpl/specter.clj @@ -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!