Skip to content

Commit

Permalink
guard transform when begin iterator is bigger than end iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
chaupow committed Jan 24, 2018
1 parent 9eb80ca commit 5550f76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 3 additions & 2 deletions include/util/coordinate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ struct Coordinate
std::string toOSMLink() const
{
std::stringstream link;
link << "http://www.openstreetmap.org/?mlat=" << lat << "&mlon=" << lon << "#map=19/" << lat
<< "/" << lon;
link << "http://www.openstreetmap.org/?mlat=" << toFloating(lat)
<< "&mlon=" << toFloating(lon) << "#map=19/" << toFloating(lat) << "/"
<< toFloating(lon);
return link.str();
}
};
Expand Down
18 changes: 14 additions & 4 deletions src/extractor/edge_based_graph_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,10 +846,13 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
}
else
{
std::transform(intersection.begin() + 1,
turn,
std::back_inserter(road_legs_on_the_right),
get_connected_road_info);
if (intersection.begin() != turn)
{
std::transform(intersection.begin() + 1,
turn,
std::back_inserter(road_legs_on_the_right),
get_connected_road_info);
}
std::transform(turn + 1,
intersection.end(),
std::back_inserter(road_legs_on_the_left),
Expand All @@ -864,6 +867,13 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
<< intersection_node << ", OSM link: "
<< m_coordinates[intersection_node].toOSMLink();
}
else if (turn == intersection.begin() && !turn->instruction.IsUTurn())
{
util::Log(logWARNING)
<< "Turn is a u turn but not classified as a u turn. Node ID: "
<< intersection_node << ", OSM link: "
<< m_coordinates[intersection_node].toOSMLink();
}

// In case a way restriction starts at a given location, add a turn onto
// every artificial node eminating here.
Expand Down

0 comments on commit 5550f76

Please sign in to comment.