diff options
-rw-r--r-- | src/clj/clojure/zip.clj | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/clj/clojure/zip.clj b/src/clj/clojure/zip.clj index 00cc3be5..57b3b21b 100644 --- a/src/clj/clojure/zip.clj +++ b/src/clj/clojure/zip.clj @@ -66,7 +66,9 @@ (defn children "Returns a seq of the children of node at loc, which must be a branch" [loc] - ((:zip/children ^loc) (node loc))) + (if (branch? loc) + ((:zip/children ^loc) (node loc)) + (throw (Exception. "called children on a leaf node")))) (defn make-node "Returns a new branch node, given an existing node and new |