Commit 8103acf9 authored by Volker Krause's avatar Volker Krause
Browse files

Don't attempt departure/journey queries if the location query failed

Those are bound to fail due to invalid GraphQL parameters then.
parent e91e1fb6
......@@ -97,6 +97,10 @@ bool OpenTripPlannerGraphQLBackend::queryLocation(const LocationRequest &req, Lo
bool OpenTripPlannerGraphQLBackend::queryStopover(const StopoverRequest &req, StopoverReply *reply, QNetworkAccessManager *nam) const
{
if (!req.stop().hasCoordinate()) {
return false;
}
auto gqlReq = graphQLRequest();
gqlReq.setQueryFromFile(graphQLPath(QStringLiteral("departure.graphql")));
gqlReq.setVariable(QStringLiteral("lat"), req.stop().latitude());
......@@ -127,6 +131,10 @@ bool OpenTripPlannerGraphQLBackend::queryStopover(const StopoverRequest &req, St
bool OpenTripPlannerGraphQLBackend::queryJourney(const JourneyRequest &req, JourneyReply *reply, QNetworkAccessManager *nam) const
{
if (!req.from().hasCoordinate() || !req.to().hasCoordinate()) {
return false;
}
auto gqlReq = graphQLRequest();
gqlReq.setQueryFromFile(graphQLPath(QStringLiteral("journey.graphql")));
gqlReq.setVariable(QStringLiteral("fromLat"), req.from().latitude());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment