From 6db9dca0219ef46d3aea0900bb80dfc7de0b9217 Mon Sep 17 00:00:00 2001 From: Bertold Van den Bergh Date: Wed, 20 Nov 2019 19:10:14 +0100 Subject: [PATCH] Only set safezone if a result was found, otherwise it is meaningless. --- aws_lambda/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aws_lambda/main.cpp b/aws_lambda/main.cpp index 9bfd52b..c0ef405 100644 --- a/aws_lambda/main.cpp +++ b/aws_lambda/main.cpp @@ -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++) {