Skip to content

Commit

Permalink
Fix possible crash (#2120)
Browse files Browse the repository at this point in the history
  • Loading branch information
HellAholic authored Jul 15, 2024
2 parents 6488675 + a3e668b commit 1d310b8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/geometry/MixedLinesSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ Shape MixedLinesSet::offset(coord_t distance, ClipperLib::JoinType join_type, do
}
else
{
static auto end_type_fn = [&line, &join_type]()
ClipperLib::EndType end_type;

if (line->hasClosingSegment())
{
end_type = ClipperLib::etClosedLine;
}
else
{
if (line->hasClosingSegment())
{
return ClipperLib::etClosedLine;
}
return join_type == ClipperLib::jtMiter ? ClipperLib::etOpenSquare : ClipperLib::etOpenRound;
};

const ClipperLib::EndType end_type{ end_type_fn() };
end_type = (join_type == ClipperLib::jtMiter) ? ClipperLib::etOpenSquare : ClipperLib::etOpenRound;
}

clipper.AddPath(line->getPoints(), join_type, end_type);
}
}
Expand Down

0 comments on commit 1d310b8

Please sign in to comment.