diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index 3b67d4ea6179f4bf2c1b081f7f3dcc5d05e19a96..6756391275fd392c2e744fc669ac2a8bba669be3 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -765,6 +765,12 @@ count_pathvector_degenerations(Geom::PathVector const &pathv) { size_t count_path_degenerations(Geom::Path const &path) { + if (path.empty()) { + std::cerr << "count_path_degenerates: path is empty!" << std::endl; + // Hmm, a path always contains a closing segment which has two nodes which are degenerate if path is empty. + return 0; + } + size_t tot = 0; Geom::Path::const_iterator curve_it = path.begin(); Geom::Path::const_iterator curve_endit = path.end_default(); @@ -791,6 +797,12 @@ size_t count_path_degenerations(Geom::Path const &path) size_t count_path_nodes(Geom::Path const &path) { + if (path.empty()) { + std::cerr << "count_path_nodes: path is empty!" << std::endl; + // Hmm, a path always contains a closing segment which has two (degenerate) nodes... + return 0; + } + size_t tot = path.size_default() + 1; // if degenerate closing line one is erased no need to duple if (path.closed()) { tot -= 1; @@ -810,6 +822,11 @@ size_t count_path_nodes(Geom::Path const &path) size_t count_path_curves(Geom::Path const &path) { + if (path.empty()) { + std::cerr << "count_path_curves: path is empty!" << std::endl; + return 0; + } + size_t tot = path.size_default(); // if degenerate closing line one is erased no need to duple if (path.closed()) { auto const &closingline = path.back_closed(); diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 70d49d48d4be3265d57ff389172566fe2e2bf2c8..d09145907f233485926466c82a488e921793c7b4 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -628,6 +628,10 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) offset_points.set_pwd2(pwd2_in , n); size_t pathindex = 0; for (auto path : pathv) { + if (path.empty()) { + std::cerr << "LPEPowerStroke::doEffect_path: empty sub-path!" << std::endl; + continue; + } size_t psize = count_pathvector_curves(path); path_init += psize; if (!offset_points.unplaced &&