From 678dfd818a6cdeb1f5b038c1a79aa75a45251358 Mon Sep 17 00:00:00 2001 From: Johan Engelen Date: Sun, 16 May 2010 00:46:50 +0200 Subject: [PATCH] lpe-knot: fix crash --- src/live_effects/lpe-knot.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) 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; } -- 2.30.2