From dc9fff94f311a90c3c4d46e8b5061fe06613a336 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 29 May 2014 14:21:46 +0100 Subject: [PATCH] Add null checks for null folders --- services/docstore/app/coffee/DocManager.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/docstore/app/coffee/DocManager.coffee b/services/docstore/app/coffee/DocManager.coffee index 18c2d52f13..74591cebfa 100644 --- a/services/docstore/app/coffee/DocManager.coffee +++ b/services/docstore/app/coffee/DocManager.coffee @@ -61,7 +61,7 @@ module.exports = DocManager = else callback null, null, null - _findDocInFolder: (folder, doc_id, currentPath) -> + _findDocInFolder: (folder = {}, doc_id, currentPath) -> for doc, i in folder.docs or [] if doc._id.toString() == doc_id.toString() return { @@ -75,7 +75,7 @@ module.exports = DocManager = return null - _findAllDocsInFolder: (folder) -> + _findAllDocsInFolder: (folder = {}) -> docs = folder.docs or [] for childFolder in folder.folders or [] docs = docs.concat @_findAllDocsInFolder childFolder