Skip to content

Commit fb47b2a

Browse files
committed
Don't crash if source is empty/unsupplied
Fixes #38.
1 parent 380fcd6 commit fb47b2a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ <h2>
108108
<code>source</code>
109109
</td>
110110
<td>
111-
null
111+
[]
112112
</td>
113113
<td>
114114
Array, String (url)

js/jquery.fn.gantt.js

100755100644
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
var scales = ["hours", "days", "weeks", "months"];
3232
//Default settings
3333
var settings = {
34-
source: null,
34+
source: [],
3535
itemsPerPage: 7,
3636
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
3737
dow: ["S", "M", "T", "W", "T", "F", "S"],
@@ -1449,7 +1449,7 @@
14491449
maxDate = maxDate < tools.dateDeserialize(date.to) ? tools.dateDeserialize(date.to) : maxDate;
14501450
});
14511451
});
1452-
1452+
maxDate = maxDate || new Date();
14531453
switch (settings.scale) {
14541454
case "hours":
14551455
maxDate.setHours(Math.ceil((maxDate.getHours()) / element.scaleStep) * element.scaleStep);
@@ -1482,6 +1482,7 @@
14821482
minDate = minDate > tools.dateDeserialize(date.from) || minDate === null ? tools.dateDeserialize(date.from) : minDate;
14831483
});
14841484
});
1485+
minDate = minDate || new Date();
14851486
switch (settings.scale) {
14861487
case "hours":
14871488
minDate.setHours(Math.floor((minDate.getHours()) / element.scaleStep) * element.scaleStep);

0 commit comments

Comments
 (0)