mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 19:12:17 +00:00
Bugfix: crash in some circumstances when avoid_crossing_perimeters is enabled. #2266
This commit is contained in:
@@ -18,10 +18,17 @@ MotionPlanner::~MotionPlanner()
|
||||
delete *graph;
|
||||
}
|
||||
|
||||
size_t
|
||||
MotionPlanner::islands_count() const
|
||||
{
|
||||
return this->islands.size();
|
||||
}
|
||||
|
||||
void
|
||||
MotionPlanner::initialize()
|
||||
{
|
||||
if (this->initialized) return;
|
||||
if (this->islands.empty()) return; // prevent initialization of empty BoundingBox
|
||||
|
||||
ExPolygons expp;
|
||||
for (ExPolygons::const_iterator island = this->islands.begin(); island != this->islands.end(); ++island) {
|
||||
@@ -70,6 +77,12 @@ MotionPlanner::shortest_path(const Point &from, const Point &to, Polyline* polyl
|
||||
{
|
||||
if (!this->initialized) this->initialize();
|
||||
|
||||
if (this->islands.empty()) {
|
||||
polyline->points.push_back(from);
|
||||
polyline->points.push_back(to);
|
||||
return;
|
||||
}
|
||||
|
||||
// Are both points in the same island?
|
||||
int island_idx = -1;
|
||||
for (ExPolygons::const_iterator island = this->islands.begin(); island != this->islands.end(); ++island) {
|
||||
|
||||
Reference in New Issue
Block a user