mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
🐛 Fix safe-subvec 3-arity evaluating (count v) before nil check
The 3-arity of safe-subvec called (count v) in a let binding before checking (some? v). While (count nil) returns 0 in Clojure and does not crash, the nil guard was dead code. Restructure to check (some? v) first with an outer when, then compute size inside the guarded block.
This commit is contained in:
parent
1cc860807e
commit
d73ab3ec92
@ -1149,11 +1149,11 @@
|
|||||||
(> start 0) (< start (count v)))
|
(> start 0) (< start (count v)))
|
||||||
(subvec v start)))
|
(subvec v start)))
|
||||||
([v start end]
|
([v start end]
|
||||||
(let [size (count v)]
|
(when (some? v)
|
||||||
(when (and (some? v)
|
(let [size (count v)]
|
||||||
(>= start 0) (< start size)
|
(when (and (>= start 0) (< start size)
|
||||||
(>= end 0) (<= start end) (<= end size))
|
(>= end 0) (<= start end) (<= end size))
|
||||||
(subvec v start end)))))
|
(subvec v start end))))))
|
||||||
|
|
||||||
(defn append-class
|
(defn append-class
|
||||||
[class current-class]
|
[class current-class]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user