From be1e3738f1b5e3a3aa2448164ed51be726571421 Mon Sep 17 00:00:00 2001 From: Denys Digtiar Date: Sun, 14 Jun 2015 13:49:21 +1000 Subject: [PATCH] Error handling is added to the GPX loading callback. Previously erroneous response was corrupting the GpxLayer, which could potential corrupt the whole Map, if user were to use 'Zoom to GPX' feature. Callback logic is wrapped in the error guard to fix this. --- js/id/renderer/background.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/id/renderer/background.js b/js/id/renderer/background.js index 3e5d4b5f6..e274891ca 100644 --- a/js/id/renderer/background.js +++ b/js/id/renderer/background.js @@ -262,8 +262,10 @@ iD.Background = function(context) { var gpx = q.gpx; if (gpx) { d3.text(gpx, function(err, gpxTxt) { - gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt))); - dispatch.change(); + if (!err) { + gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt))); + dispatch.change(); + } }); } };