From 915f00e21a984ba219618b98d91c48e5596809ff Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Sun, 3 Jun 2012 22:08:22 +0100 Subject: [PATCH] [view/timeline,bugfix][xs]: timeline crashes if no entries so create placeholder entry for timeline if no entries from data. --- src/view-timeline.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/view-timeline.js b/src/view-timeline.js index 9d98d371..c556a1e4 100644 --- a/src/view-timeline.js +++ b/src/view-timeline.js @@ -92,6 +92,14 @@ my.Timeline = Backbone.View.extend({ out.timeline.date.push(tlEntry); } }); + // if no entries create a placeholder entry to prevent Timeline crashing with error + if (out.timeline.date.length === 0) { + var tlEntry = { + "startDate": '2000,1,1', + "headline": 'No data to show!' + }; + out.timeline.date.push(tlEntry); + } return out; },