From d73ab3ec92b4af8a445db1545f54af9de614a512 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 14 Apr 2026 20:11:46 +0000 Subject: [PATCH] :bug: 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. --- common/src/app/common/data.cljc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/src/app/common/data.cljc b/common/src/app/common/data.cljc index 2da21aadb0..6b2cc5d3b4 100644 --- a/common/src/app/common/data.cljc +++ b/common/src/app/common/data.cljc @@ -1149,11 +1149,11 @@ (> start 0) (< start (count v))) (subvec v start))) ([v start end] - (let [size (count v)] - (when (and (some? v) - (>= start 0) (< start size) - (>= end 0) (<= start end) (<= end size)) - (subvec v start end))))) + (when (some? v) + (let [size (count v)] + (when (and (>= start 0) (< start size) + (>= end 0) (<= start end) (<= end size)) + (subvec v start end)))))) (defn append-class [class current-class]