Fix error when chapters list is empty

Fix GitbookIO/gitbook.io#101 and GitbookIO/gitbook.io#102
This commit is contained in:
Samy Pessé
2014-06-24 12:34:29 +02:00
parent 86f8a9d8fb
commit 8b6a80cffb
+6 -4
View File
@@ -100,11 +100,13 @@ function parseChapter(nodes, nums) {
function defaultChapterList(chapterList) {
var first = _.first(chapterList);
var chapter = parseChapter(first, [0]);
if (first) {
var chapter = parseChapter(first, [0]);
// Already have README node, we're good to go
if(chapter.path === 'README.md') {
return chapterList;
// Already have README node, we're good to go
if(chapter.path === 'README.md') {
return chapterList;
}
}
return [