Skip to content

Commit

Permalink
Fix error involving location and has_coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
SebMilardo committed May 23, 2024
1 parent e728155 commit da6ca51
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/bind/solution/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ void init_solution(py::module_ &m) {
strncpy(ptr[idx].type, type.c_str(), 9);
strncpy(ptr[idx].description, step.description.c_str(), 40);

ptr[idx].longitude = step.location.has_value()
? step.location.value().lat()
: NA_SUBSTITUTE;
ptr[idx].latitude = step.location.has_value()
? step.location.value().lat()
: NA_SUBSTITUTE;
ptr[idx].longitude =
step.location.has_value() &&
step.location.value().has_coordinates()
? step.location.value().coordinates().lon
: NA_SUBSTITUTE;
ptr[idx].latitude =
step.location.has_value() &&
step.location.value().has_coordinates()
? step.location.value().coordinates().lat
: NA_SUBSTITUTE;
ptr[idx].location_index = step.location.has_value()
? step.location.value().index()
: NA_SUBSTITUTE;
Expand Down

0 comments on commit da6ca51

Please sign in to comment.