Browse files

Fix null pointer exception when issuing a retraction with an empty co…

…llection of tuples.
  • Loading branch information...
1 parent d777498 commit d613316bbce889906b4ad2172970258bf0f16916 @mtnygard mtnygard committed with David Nolen May 18, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/main/clojure/clojure/core/logic.clj
@@ -1652,7 +1652,8 @@
"Retract a series of facts. Takes a vector of vectors where each vector
represents a fact tuple, all with the same number of elements. It is not
an error to retract a fact that isn't true."
- ([rel [f :as tuples]] (retractions rel (count f) tuples))
+ ([rel [f :as tuples]]
+ (when f (retractions rel (count f) tuples)))
([^Rel rel arity tuples]
(let [rel-ns (:ns (meta rel))
rel-set (var-get (ns-resolve rel-ns (set-sym (.name rel) arity)))
@@ -2086,4 +2087,4 @@
[u v]
`(fn [a#]
- (!=-verify a# (unify a# ~u ~v))))
+ (!=-verify a# (unify a# ~u ~v))))

0 comments on commit d613316

Please sign in to comment.