diff --git a/LiteCore/Database/TreeDocument.cc b/LiteCore/Database/TreeDocument.cc index 0c300d6e0e0900f0d16c670475db1479ee231d09..17f3c9dc789744e3a6d9f027f0931659afd17cd6 100644 --- a/LiteCore/Database/TreeDocument.cc +++ b/LiteCore/Database/TreeDocument.cc @@ -105,6 +105,8 @@ namespace c4Internal { if (!_revTree.revsAvailable()) { LogTo(DBLog, "Need to read rev-tree of doc '%.*s'", SPLAT(docID)); _revTree.read(kEntireBody); + if (!_revTree.revsAvailable()) + error::_throw(error::NotFound, "Cannot load document's revisions"); selectRevision(_revTree.currentRevision()); } } diff --git a/LiteCore/Storage/SQLiteKeyStore.cc b/LiteCore/Storage/SQLiteKeyStore.cc index 18634082ff5de8e95bd09d8111370efddf440888..c8fc8cd25174321d7364eef65d574fce41914bd5 100644 --- a/LiteCore/Storage/SQLiteKeyStore.cc +++ b/LiteCore/Storage/SQLiteKeyStore.cc @@ -282,6 +282,7 @@ namespace litecore { stmt->bindNoCopy(1, (const char*)rec.key().buf, (int)rec.key().size); UsingStatement u(*stmt); if (!stmt->executeStep()) { + rec.clearMetaAndBody(); return false; }