From 66cd5d148196525146b81e43b6b403376907b842 Mon Sep 17 00:00:00 2001 From: slerena Date: Wed, 14 Sep 2011 10:59:53 +0000 Subject: [PATCH] 2011-09-14 Sancho Lerena * lib/PandoraFMS/DataServer.pm: Fixed a weird problem resolving GPS coordinates with OpenStreet. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4950 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 4 +++- pandora_server/lib/PandoraFMS/DataServer.pm | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index b0ba73edfc..f0534a518d 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,6 +1,8 @@ - 2011-09-14 Sancho Lerena + * lib/PandoraFMS/DataServer.pm: Fixed a weird problem resolving GPS + coordinates with OpenStreet. + * lib/PandoraFMS/NmapParser.pm: Avoid warning messages. 2011-09-12 Sancho Lerena diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 829e4b2508..c874bd88dc 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -235,11 +235,14 @@ sub process_xml_data ($$$$$) { # Change here URL to make request to a local openstreetmap server my $content = get ('http://nominatim.openstreetmap.org/reverse?format=csv&lat='.$latitude.'&lon='.$longitude.'&zoom=18&addressdetails=1&email=info@pandorafms.org'); - # Yep, I need to parse the XML output. - - my $xs1 = XML::Simple->new(); - my $doc = $xs1->XMLin($content); - $position_description = safe_input ($doc->{result}{content}); + if ((defined($content)) && ($content ne "")){ + # Yep, I need to parse the XML output. + my $xs1 = XML::Simple->new(); + my $doc = $xs1->XMLin($content); + $position_description = safe_input ($doc->{result}{content}); + } else { + $position_description = ""; + } } }