Skip to content

Commit

Permalink
Make showfor more resilient to missing data.
Browse files Browse the repository at this point in the history
  • Loading branch information
mythmon committed Feb 4, 2016
1 parent b50b64c commit ce9b490
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion kitsune/sumo/static/sumo/js/showfor.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@
/* Get the product/platform data from the DOM, and munge it into the
* desired format. */
ShowFor.prototype.loadData = function() {
this.data = JSON.parse(this.$container.find('.showfor-data').html());
try {
this.data = JSON.parse(this.$container.find('.showfor-data').html());
} catch (e) {
this.data = {
products: [],
platforms: [],
versions: [],
};
}
this.productSlugs = this.data.products.map(function(prod) {
return prod.slug;
});
Expand Down

0 comments on commit ce9b490

Please sign in to comment.