Skip to content

Commit

Permalink
Check that evaluation of surface generates results before processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusyoung committed Feb 2, 2021
1 parent e71efcc commit a1a5951
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/otp_evaluate_surface.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ otp_evaluate_surface <-
error.id <- "OK"
}

# Check that there are some results
if (length(asjson$data[[1]]$sums) == 0) {
response <-
list(
"errorId" = 1001,
"errorMessage" = "No results - are the pointset destinations within the area covered by the surface?",
"query" = url
)
return (response)
}

response <- list()
response["errorId"] <- error.id
response["surfaceId"] <- as.integer(surfaceId)
Expand Down

0 comments on commit a1a5951

Please sign in to comment.