From cae80cb2a8ddbfe4d3e92896b86276b24d1e54ab Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Fri, 27 Jan 2023 09:29:57 +0100 Subject: [PATCH] Try to fix asan build. --- src/libslic3r/Emboss.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Emboss.cpp b/src/libslic3r/Emboss.cpp index 42e966509..0ae638777 100644 --- a/src/libslic3r/Emboss.cpp +++ b/src/libslic3r/Emboss.cpp @@ -116,9 +116,13 @@ void remove_spikes(ExPolygons &expolygons, const SpikeDesc &spike_desc); bool priv::remove_when_spike(Polygon &polygon, size_t index, const SpikeDesc &spike_desc) { Points &pts = polygon.points; + size_t pts_size = pts.size(); + if (pts_size < 3) + return false; + const Point &a = (index == 0) ? pts.back() : pts[index-1]; const Point &b = pts[index]; - const Point &c = (&b == &pts.back())? pts.front() : pts[index+1]; + const Point &c = (index == (pts_size - 1)) ? pts.front() : pts[index + 1]; // calc sides Vec2d ba = (a - b).cast();