Skip to content

Unhandled error with no location provided and costs matrix only #826

@jcoupey

Description

@jcoupey

It is valid to not provide locations and instead use location_index keys to refer to custom matrices row/columns. In that case:

  • when no matrix is provided, we issue a relevant error;
  • if only a durations matrix is provided, it is used for costs too;
  • if only a costs matrix is provided, we should report an error too.

In the latter situation, we still try to compute the durations matrix using a routing engine but the code crashes since no location is provided. Example when changing durations to costs in example_2 in debug mode:

$ vroom -i example_2_costs.json 
vroom: structures/vroom/location.cpp:41: vroom::Coordinate vroom::Location::lat() const: Assertion `this->has_coordinates()' failed.
Aborted (core dumped)

Using v1.12.0, the outcome is a bit cleaner but the error message is totally obscure:

$ vroom_v1.12.0 -i example_2_costs.json 
[Error] bad optional access
{"code":1,"error":"bad optional access"}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions