Skip to content

Commit

Permalink
Fixed crashes due to obvious mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Apr 10, 2024
1 parent dc4c4e1 commit 60046cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/geometry/lines_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class LinesSet

void push_back(const LinesSet& other)
{
lines_.insert(other.lines_.end(), other.lines_.begin(), other.lines_.end());
lines_.insert(lines_.end(), other.lines_.begin(), other.lines_.end());
}

void pop_back()
Expand Down Expand Up @@ -151,7 +151,7 @@ class LinesSet

std::vector<LineType>::iterator erase(std::vector<LineType>::const_iterator first, std::vector<LineType>::const_iterator last)
{
lines_.erase(first, last);
return lines_.erase(first, last);
}

LinesSet& operator=(LinesSet&& other)
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ Shape Shape::removeNearSelfIntersections() const
map_poly& wpoly = mwpoly.back();
for (auto& path : polygon)
{
wpoly.push_back(std::move(*reinterpret_cast<std::vector<mapbox::geometry::point<coord_t>>*>(&path)));
wpoly.push_back(std::move(*reinterpret_cast<std::vector<mapbox::geometry::point<coord_t>>*>(&path.getPoints())));
for (auto& point : wpoly.back())
{
point.x /= 4;
Expand Down
4 changes: 1 addition & 3 deletions src/utils/Simplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ MixedLinesSet Simplify::polyline(const MixedLinesSet& polylines) const

ClosedPolyline Simplify::polyline(const ClosedPolyline& polyline) const
{
assert(polyline.addClosingSegment() && "Simplify algorithm doesn't expect explicitely closed polylines");
constexpr bool is_closed = false;
return simplify(polyline, is_closed);
return simplify(polyline, polyline.isExplicitelyClosed());
}

OpenPolyline Simplify::polyline(const OpenPolyline& polyline) const
Expand Down

0 comments on commit 60046cd

Please sign in to comment.