From b387f6954eef6c426fedd52f20bf5f04dcd47816 Mon Sep 17 00:00:00 2001 From: cilix42 Date: Tue, 15 Jul 2008 12:41:14 +0000 Subject: [PATCH] Cherry-pick of 2geom update (re. 1488); prevent crash during Path->Piecewise conversion for zero length paths --- src/2geom/path.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/2geom/path.h b/src/2geom/path.h index 1c142f98d..1e9aa1d42 100644 --- a/src/2geom/path.h +++ b/src/2geom/path.h @@ -270,12 +270,19 @@ public: Piecewise > ret; ret.push_cut(0); unsigned i = 1; + bool degenerate = true; // pw> is always open. so if path is closed, add closing segment as well to pwd2. for(const_iterator it = begin(); it != end_default(); ++it) { if (!it->isDegenerate()) { ret.push(it->toSBasis(), i++); + degenerate = false; } } + if (degenerate) { + // if path only contains degenerate curves, no second cut is added + // so we need to create at least one segment manually + ret = Piecewise >(initialPoint()); + } return ret; } -- 2.30.2