From c30ae857af7f2e2bccf974da34cf2f3868e7b7f2 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 4 Jul 2019 21:12:12 +0100 Subject: Improve map JavaScript defensiveness. Add more checking for map things so e.g. on a skipped map page we stop getting JavaScript errors given there is no map present. --- web/js/duplicates.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'web/js/duplicates.js') diff --git a/web/js/duplicates.js b/web/js/duplicates.js index 0844cb5f3..3ed7e6079 100644 --- a/web/js/duplicates.js +++ b/web/js/duplicates.js @@ -121,6 +121,9 @@ } function render_duplicate_pins(api_response) { + if (!fixmystreet.markers) { + return; + } var markers = fixmystreet.maps.markers_list( api_response.pins, true ); fixmystreet.markers.removeFeatures( current_duplicate_markers ); fixmystreet.markers.addFeatures( markers ); @@ -138,6 +141,9 @@ } function remove_duplicate_pins() { + if (!fixmystreet.markers) { + return; + } fixmystreet.markers.removeFeatures( current_duplicate_markers ); } -- cgit v1.2.3