From 1c38198c02b5d3029dd0e9d88f1f322cf1ca7b3f Mon Sep 17 00:00:00 2001 From: patrik Date: Sun, 29 Jan 2012 05:52:04 +0000 Subject: [PATCH] Changed JSON null-check to the json.NULL constant per David's recommendation. --- scripts/ip-geolocation-geoplugin.nse | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/ip-geolocation-geoplugin.nse b/scripts/ip-geolocation-geoplugin.nse index a76aaa551..d492be8d3 100755 --- a/scripts/ip-geolocation-geoplugin.nse +++ b/scripts/ip-geolocation-geoplugin.nse @@ -41,9 +41,7 @@ local geoplugin = function(ip) local output = {} table.insert(output, "coordinates (lat,lon): "..loc.geoplugin_latitude..","..loc.geoplugin_longitude) - -- The JSON response for regionName contains a null sometimes which is represented - -- as a table by the library. - local regionName = ("table" == type(loc.geoplugin_regionName)) and "Unknown" or loc.geoplugin_regionName + local regionName = (loc.geoplugin_regionName == json.NULL) and "Unknown" or loc.geoplugin_regionName table.insert(output,"state: ".. regionName ..", ".. loc.geoplugin_countryName) return output