Fixes #649 – cant delete a draft document that has had its collection previously removed

This commit is contained in:
Tom Moor
2018-05-19 15:38:08 -07:00
parent a4b5d6cabe
commit d557ef96ac
3 changed files with 48 additions and 1 deletions

View File

@ -412,7 +412,7 @@ router.post('documents.delete', auth(), async ctx => {
authorize(ctx.state.user, 'delete', document);
const collection = document.collection;
if (collection.type === 'atlas') {
if (collection && collection.type === 'atlas') {
// Delete document and all of its children
await collection.removeDocument(document);
}