summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2025-05-21 18:24:04 +0200
committerGitHub <noreply@github.com>2025-05-21 18:24:04 +0200
commitd4ce0d435e6ffb8f05b0a5d835c745df7f7014f0 (patch)
tree4c3beef278895e61d9f4c30c1e8d5f3cd295a406 /lib
parent20f2d387247715f4678638ae29cbf68f237d0dd5 (diff)
prevent erroring out on #3742 (#3743)
Diffstat (limited to 'lib')
-rw-r--r--lib/elements/element.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py
index 838f6679..7b558506 100644
--- a/lib/elements/element.py
+++ b/lib/elements/element.py
@@ -600,9 +600,13 @@ class EmbroideryElement(object):
def _get_gradient_cache_key_data(self):
gradient = {}
if hasattr(self, 'gradient') and self.gradient is not None:
- gradient['stops'] = self.gradient.stop_offsets
- gradient['orientation'] = [self.gradient.x1(), self.gradient.x2(), self.gradient.y1(), self.gradient.y2()]
- gradient['styles'] = [(stop.style('stop-color'), stop.style('stop-opacity')) for stop in self.gradient.stops]
+ # prevent issue with color parsing: https://github.com/inkstitch/inkstitch/issues/3742
+ try:
+ gradient['stops'] = self.gradient.stop_offsets
+ gradient['orientation'] = [self.gradient.x1(), self.gradient.x2(), self.gradient.y1(), self.gradient.y2()]
+ gradient['styles'] = [(stop.style('stop-color'), stop.style('stop-opacity')) for stop in self.gradient.stops]
+ except ValueError:
+ pass
return gradient
def _get_tartan_key_data(self):