Try to fix asan build.

This commit is contained in:
Filip Sykala - NTB T15p 2023-01-27 09:29:57 +01:00
parent 8cf63bfc94
commit cae80cb2a8

View File

@ -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) { bool priv::remove_when_spike(Polygon &polygon, size_t index, const SpikeDesc &spike_desc) {
Points &pts = polygon.points; 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 &a = (index == 0) ? pts.back() : pts[index-1];
const Point &b = pts[index]; 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 // calc sides
Vec2d ba = (a - b).cast<double>(); Vec2d ba = (a - b).cast<double>();