Skip to content

Commit

Permalink
Make sure nodes/find-one handles empty result lists
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed May 5, 2012
1 parent f6b4dd5 commit 8d2ba86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/clojure/clojurewerkz/neocons/rest/nodes.clj
Expand Up @@ -204,7 +204,8 @@
[^String idx key value]
(let [{:keys [status body]} (rest/GET (index-lookup-location-for rest/*endpoint* idx key value))
[node] (json/read-json body true)]
(fetch-from (:indexed node))))
(when node
(fetch-from (:indexed node)))))


(defn query
Expand Down
1 change: 1 addition & 0 deletions test/clojurewerkz/neocons/rest/test_integration.clj
Expand Up @@ -42,4 +42,5 @@
(:id (nn/find-one "by-url" :url "http://clojurewerkz.org/"))))
(is (= (:id community)
(:id (nn/find-one "by-url" :url "http://clojurewerkz.org/articles/community.html"))))
(is (nil? (nn/find-one "by-url" :url "http://example99.com")))
(nn/delete-index "by-url")))

0 comments on commit 8d2ba86

Please sign in to comment.