summaryrefslogtreecommitdiffstats
path: root/src/knot-holder-entity.cpp
diff options
context:
space:
mode:
authorNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-05-25 10:14:13 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2019-07-15 10:35:33 +0000
commitcdfe88fdf72647144a10d3230c663977364f3d00 (patch)
tree0aad4da5f080ed20e24cc70581194f8012440d35 /src/knot-holder-entity.cpp
parentOverride navigation in swatch/gradient list (diff)
downloadinkscape-cdfe88fdf72647144a10d3230c663977364f3d00.tar.gz
inkscape-cdfe88fdf72647144a10d3230c663977364f3d00.zip
Check knot's pattern still exists before update
Stop crash when pattern changed via swatch palette, and knot is still present. https://gitlab.com/inkscape/inkscape/issues/70
Diffstat (limited to 'src/knot-holder-entity.cpp')
-rw-r--r--src/knot-holder-entity.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp
index 7abd16cba..e8f97e453 100644
--- a/src/knot-holder-entity.cpp
+++ b/src/knot-holder-entity.cpp
@@ -172,6 +172,27 @@ static Geom::Point sp_pattern_knot_get(SPPattern const *pat, gdouble x, gdouble
return Geom::Point(x, y) * pat->getTransform();
}
+bool
+PatternKnotHolderEntityXY::knot_missing() const
+{
+ SPPattern *pat = _fill ? SP_PATTERN(item->style->getFillPaintServer()) : SP_PATTERN(item->style->getStrokePaintServer());
+ return (pat == nullptr);
+}
+
+bool
+PatternKnotHolderEntityAngle::knot_missing() const
+{
+ SPPattern *pat = _fill ? SP_PATTERN(item->style->getFillPaintServer()) : SP_PATTERN(item->style->getStrokePaintServer());
+ return (pat == nullptr);
+}
+
+bool
+PatternKnotHolderEntityScale::knot_missing() const
+{
+ SPPattern *pat = _fill ? SP_PATTERN(item->style->getFillPaintServer()) : SP_PATTERN(item->style->getStrokePaintServer());
+ return (pat == nullptr);
+}
+
Geom::Point
PatternKnotHolderEntityXY::knot_get() const
{
@@ -183,7 +204,6 @@ Geom::Point
PatternKnotHolderEntityAngle::knot_get() const
{
SPPattern *pat = _fill ? SP_PATTERN(item->style->getFillPaintServer()) : SP_PATTERN(item->style->getStrokePaintServer());
-
return sp_pattern_knot_get(pat, pat->width(), 0);
}