aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/duplicates.js
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-07-04 21:12:12 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-07-10 15:53:27 +0100
commitc30ae857af7f2e2bccf974da34cf2f3868e7b7f2 (patch)
treed5237c547791a17786ac6e40735bea7a7ea75a2e /web/js/duplicates.js
parent12d234639171b0965c2ce5cf0fea5a6af180cc9b (diff)
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.
Diffstat (limited to 'web/js/duplicates.js')
-rw-r--r--web/js/duplicates.js6
1 files changed, 6 insertions, 0 deletions
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 );
}