Add in extra null check

This commit is contained in:
James Allen 2014-06-05 10:20:56 +01:00
parent 32f1a327a6
commit 828aefe2c8

View file

@ -63,7 +63,7 @@ module.exports = DocManager =
_findDocInFolder: (folder = {}, doc_id, currentPath) -> _findDocInFolder: (folder = {}, doc_id, currentPath) ->
for doc, i in folder.docs or [] for doc, i in folder.docs or []
if doc._id? and doc._id.toString() == doc_id.toString() if doc?._id? and doc._id.toString() == doc_id.toString()
return { return {
doc: doc doc: doc
mongoPath: "#{currentPath}.docs.#{i}" mongoPath: "#{currentPath}.docs.#{i}"