From 6d5c109d78e32ad4f491efe028845bfbf3f490bb Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sat, 27 Nov 2021 19:38:27 +0300 Subject: [PATCH] fix: cannot create undefined style --- modules/ui/style.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ui/style.js b/modules/ui/style.js index 2a4f6d2c..bbaa6a93 100644 --- a/modules/ui/style.js +++ b/modules/ui/style.js @@ -1126,8 +1126,9 @@ function addStylePreset() { position: {my: "center", at: "center", of: "svg"} }); - const currentStyle = document.getElementById("stylePreset").selectedOptions[0].text; - document.getElementById("styleSaverName").value = currentStyle; + const currentPreset = document.getElementById("stylePreset").selectedOptions[0]; + const styleName = currentPreset ? currentPreset.text : "custom"; + document.getElementById("styleSaverName").value = styleName; styleSaverJSON.value = JSON.stringify(getStyle(), null, 2); checkName();