aboutsummaryrefslogtreecommitdiffstats
path: root/web/cobrands
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-01-20 15:35:31 +0000
committerMatthew Somerville <matthew@mysociety.org>2016-01-20 15:41:36 +0000
commit47d534a2ac59335474be97fbb9fa9fc39f0464c7 (patch)
tree62aa3d9b09bc1c2e79d1bad8472661d5f5c86c98 /web/cobrands
parent9232c62b050f5b9371b3c74dfe57e87ad186b9c9 (diff)
Make sure data variable is defined before use.
e.g. if you had skipped the map there is no fixmystreet variable on the resulting page, so we need to create it and check it.
Diffstat (limited to 'web/cobrands')
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 3b81ad144..975a8e227 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -246,13 +246,15 @@ $(function(){
}
});
- $.each(fixmystreet.uploaded_files || [], function(i, f) {
- var mockFile = { name: f, server_id: f };
- photodrop.emit("addedfile", mockFile);
- photodrop.createThumbnailFromUrl(mockFile, '/photo/' + f + '.temp.jpeg');
- photodrop.emit("complete", mockFile);
- photodrop.options.maxFiles -= 1;
- });
+ if (typeof fixmystreet !== 'undefined') {
+ $.each(fixmystreet.uploaded_files || [], function(i, f) {
+ var mockFile = { name: f, server_id: f };
+ photodrop.emit("addedfile", mockFile);
+ photodrop.createThumbnailFromUrl(mockFile, '/photo/' + f + '.temp.jpeg');
+ photodrop.emit("complete", mockFile);
+ photodrop.options.maxFiles -= 1;
+ });
+ }
}
/*