0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

🐛 Fix NPE on number schemas

Mainly, without this fix, happens the following:

user=> (sm/validate [::sm/int {:min 0}] nil)
Execution error (NullPointerException) at app.common.schema/fn$fn (schema.cljc:692).
Cannot invoke "Object.getClass()" because "x" is null

And it should return `false` without an exception.
This commit is contained in:
Andrey Antukh 2024-11-06 09:15:06 +01:00
parent b160ba1793
commit 946dac3c9f

View file

@ -681,8 +681,8 @@
(let [pred int?
pred (if (some? min)
(fn [v]
(and (>= v min)
(pred v)))
(and (pred v)
(>= v min)))
pred)
pred (if (some? max)
(fn [v]
@ -719,8 +719,8 @@
(let [pred double?
pred (if (some? min)
(fn [v]
(and (>= v min)
(pred v)))
(and (pred v)
(>= v min)))
pred)
pred (if (some? max)
(fn [v]
@ -749,8 +749,8 @@
(let [pred number?
pred (if (some? min)
(fn [v]
(and (>= v min)
(pred v)))
(and (pred v)
(>= v min)))
pred)
pred (if (some? max)
(fn [v]