Only set safezone if a result was found, otherwise it is meaningless.

This commit is contained in:
Bertold Van den Bergh 2019-11-20 19:10:14 +01:00
parent 6ab3a273a4
commit 6db9dca021

View file

@ -45,13 +45,12 @@ invocation_response zd_handler(invocation_request const& request){
float safezone = 0;
auto results = ZDLookup(zd, lat, lon, &safezone);
body["Safezone"] = safezone;
if(results){
int index = 0;
while(results[index].lookupResult != ZD_LOOKUP_END) {
auto& zone = body["Zones"][index];
zone["Result"] = ZDLookupResultToString(results[index].lookupResult);
body["Safezone"] = safezone;
if(results[index].data) {
for(unsigned int i = 0; i < results[index].numFields; i++) {