From 1a6273b512d9e69b21791b7295fdc7e3922d4ca2 Mon Sep 17 00:00:00 2001 From: Ryan Bertrand Date: Mon, 25 Jul 2016 23:16:21 -0700 Subject: [PATCH] Check value is not nil before calling re-matches It seems that calling re-matches when the value pulled from params is nil throws an error. --- src/secretary/core.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/secretary/core.cljs b/src/secretary/core.cljs index 753fd73..6be799f 100644 --- a/src/secretary/core.cljs +++ b/src/secretary/core.cljs @@ -326,7 +326,7 @@ (defn invalid-params [params validations] (reduce (fn [m [key validation]] (let [value (get params key)] - (if (re-matches validation value) + (if (and (not= nil value) (re-matches validation value)) m (assoc m key [value validation])))) {} (partition 2 validations)))