From 5b3f54fbc85dc70d6c2a5dc7fbcc70a29d4f1204 Mon Sep 17 00:00:00 2001 From: Samy Pesse Date: Tue, 10 May 2016 09:55:22 +0200 Subject: [PATCH] Fix "gitbook init" when article has no ref --- lib/init.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/init.js b/lib/init.js index 3e3cdca08..c112d4d08 100644 --- a/lib/init.js +++ b/lib/init.js @@ -47,8 +47,11 @@ function initBook(rootFolder) { // Write pages return Promise.forEach(articles, function(article) { - var filePath = path.join(rootFolder, article.getPath()); - if (!filePath) return; + var articlePath = article.getPath(); + var filePath = articlePath? path.join(rootFolder, articlePath) : null; + if (!filePath) { + return; + } return fs.assertFile(filePath, function() { return fs.ensureFile(filePath)