From 4e3abcbd451f8ffb5c190547983f6e3badfb84d1 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 28 Apr 2025 11:26:04 +0200 Subject: [PATCH] :bug: Prevent NPE on get-points --- common/src/app/common/types/path.cljc | 6 ++++++ frontend/src/app/main/ui/workspace/shapes/path/editor.cljs | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/types/path.cljc b/common/src/app/common/types/path.cljc index 44584b012e..bdbbd9e39a 100644 --- a/common/src/app/common/types/path.cljc +++ b/common/src/app/common/types/path.cljc @@ -164,6 +164,12 @@ ;; PATH SHAPE HELPERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defn get-points + "Returns points for the given segment, faster version of + the `content->points`." + [content] + (some-> content segment/get-points)) + (defn- calc-bool-content* "Calculate the boolean content from shape and objects. Returns plain vector of segments" diff --git a/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs b/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs index aa99ec566a..a19f265817 100644 --- a/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs @@ -272,7 +272,8 @@ hover-handlers hover-points snap-toggled] - :as edit-path} (mf/deref edit-path-ref) + :as edit-path} + (mf/deref edit-path-ref) selected-points (or selected-points #{}) shape (hooks/use-equal-memo shape) @@ -282,7 +283,7 @@ base-points (mf/with-memo [base-content] - (path.segment/get-points base-content)) + (path/get-points base-content)) content (mf/with-memo [base-content content-modifiers] @@ -290,7 +291,7 @@ content-points (mf/with-memo [content] - (path.segment/get-points content)) + (path/get-points content)) point->base (->> (map hash-map content-points base-points) (reduce merge)) base->point (map-invert point->base)