From 23d5fc7408848b7a9974809a5810c8e8432ca0da Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 21 Jan 2026 09:25:22 +0100 Subject: [PATCH] :bug: Prevent exception on open-new-window when no window is returned Fixes https://github.com/penpot/penpot/issues/7787 --- CHANGES.md | 1 + frontend/src/app/util/dom.cljs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 6754a5045a..c3b176e71e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -34,6 +34,7 @@ - Fix spanish translations on import export token modal [Taiga #13171](https://tree.taiga.io/project/penpot/issue/13171) - Remove whitespaces from asset export filename [Github #8133](https://github.com/penpot/penpot/pull/8133) - Fix exception on uploading large fonts [Github #8135](https://github.com/penpot/penpot/pull/8135) +- Fix unhandled exception on open-new-window helper [Github #7787](https://github.com/penpot/penpot/issues/7787) ## 2.12.1 diff --git a/frontend/src/app/util/dom.cljs b/frontend/src/app/util/dom.cljs index 2faa6cc1c0..e22de0dbba 100644 --- a/frontend/src/app/util/dom.cljs +++ b/frontend/src/app/util/dom.cljs @@ -802,9 +802,10 @@ ([uri name] (open-new-window uri name "noopener,noreferrer")) ([uri name features] - (let [new-window (.open js/window (str uri) name features)] + (when-let [new-window (.open js/window (str uri) name features)] (when (not= name "_blank") - (.reload (.-location new-window)))))) + (when-let [location (.-location new-window)] + (.reload location)))))) (defn browser-back []