From: Johan Engelen Date: Sat, 15 May 2010 22:46:50 +0000 (+0200) Subject: lpe-knot: fix crash X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=678dfd818a6cdeb1f5b038c1a79aa75a45251358;p=inkscape.git lpe-knot: fix crash --- diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index b3aa2df45..b8e9b8cf9 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -56,17 +56,19 @@ public: static std::vector complementOf(Geom::Interval I, std::vector domain){ std::vector ret; - double min = domain.front().min(); - double max = domain.back().max(); - Geom::Interval I1 = Geom::Interval(min,I.min()); - Geom::Interval I2 = Geom::Interval(I.max(),max); - - for (unsigned i = 0; i I1i = intersect(domain.at(i),I1); - if (I1i && !I1i->isSingular()) ret.push_back(I1i.get()); - boost::optional I2i = intersect(domain.at(i),I2); - if (I2i && !I2i->isSingular()) ret.push_back(I2i.get()); - } + if (!domain.empty()) { + double min = domain.front().min(); + double max = domain.back().max(); + Geom::Interval I1 = Geom::Interval(min,I.min()); + Geom::Interval I2 = Geom::Interval(I.max(),max); + + for (unsigned i = 0; i I1i = intersect(domain.at(i),I1); + if (I1i && !I1i->isSingular()) ret.push_back(I1i.get()); + boost::optional I2i = intersect(domain.at(i),I2); + if (I2i && !I2i->isSingular()) ret.push_back(I2i.get()); + } + } return ret; }