aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-08-29 09:54:10 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-08-29 10:31:42 +0100
commit02b61ee82cc046fe4446861397ac0592c5da08ed (patch)
tree064018805900183380d499ab433ad47aff548a1e
parentf83e44a8c1b41491686a3831e14529e6e554c653 (diff)
Check we have by-category data/map before action.
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index a5267d4f2..b663d37ba 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -391,7 +391,9 @@ $.extend(fixmystreet.set_up, {
// /report/new), fetch it first. That will then automatically call this
// function again, due to it calling change() on the category if set.
if (!fixmystreet.reporting_data) {
- fixmystreet.update_pin(fixmystreet.map.getCenter(), false);
+ if (fixmystreet.map) {
+ fixmystreet.update_pin(fixmystreet.map.getCenter(), false);
+ }
return;
}
@@ -399,6 +401,11 @@ $.extend(fixmystreet.set_up, {
data = fixmystreet.reporting_data.by_category[category],
$category_meta = $('#category_meta');
+ if (!data) {
+ // The Pick a category option, or something gone wrong
+ return;
+ }
+
fixmystreet.bodies = data.bodies || [];
if (fixmystreet.body_overrides) {
fixmystreet.body_overrides.clear();