From 43ed71e82c0b03f60dbe5e264a9f378190e2e46c Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 7 May 2014 16:24:47 +0100 Subject: [PATCH] Do a check for null docs --- services/docstore/app/coffee/HttpController.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/docstore/app/coffee/HttpController.coffee b/services/docstore/app/coffee/HttpController.coffee index 781376b5a5..5a4115699e 100644 --- a/services/docstore/app/coffee/HttpController.coffee +++ b/services/docstore/app/coffee/HttpController.coffee @@ -18,7 +18,11 @@ module.exports = HttpController = logger.log project_id: project_id, "getting all docs" DocManager.getAllDocs project_id, (error, docs = []) -> return next(error) if error? - res.json docs.map(HttpController._buildDocView) + docViews = [] + for doc in docs + if doc? # There can end up being null docs for some reason :( (probably a race condition) + docViews.push HttpController._buildDocView(doc) + res.json docViews updateDoc: (req, res, next = (error) ->) -> project_id = req.params.project_id