diff --git a/src/engine/plugins/table.cpp b/src/engine/plugins/table.cpp index 2d13e1051..27e310054 100644 --- a/src/engine/plugins/table.cpp +++ b/src/engine/plugins/table.cpp @@ -44,17 +44,18 @@ Status TablePlugin::HandleRequest(const api::TableParameters ¶ms, util::json result); } + // Empty sources or destinations means the user wants all of them included, respectively + // The ManyToMany routing algorithm we dispatch to below already handles this perfectly. + const auto num_sources = + params.sources.empty() ? params.coordinates.size() : params.sources.size(); + const auto num_destinations = + params.destinations.empty() ? params.coordinates.size() : params.destinations.size(); + if (max_locations_distance_table > 0 && - (params.sources.size() * params.destinations.size() > + ((num_sources * num_destinations) > static_cast(max_locations_distance_table * max_locations_distance_table))) { - return Error( - "InvalidOptions", - "Number of entries " + - std::to_string(params.sources.size() * params.destinations.size()) + - " is higher than current maximum (" + - std::to_string(max_locations_distance_table * max_locations_distance_table) + ")", - result); + return Error("TooBig", "Too many table coordinates", result); } auto snapped_phantoms = SnapPhantomNodes(GetPhantomNodes(params));