bin/rebuildPad.js: Fix check for existing rev

pull/4656/head
Richard Hansen 2021-01-29 17:23:11 -05:00 committed by John McLear
parent 846e3e9fbd
commit 0ad0160b7c
1 changed files with 1 additions and 3 deletions

View File

@ -56,9 +56,7 @@ const newPadId = process.argv[4] || `${padId}-rebuilt`;
newPad.pool.numToAttrib = oldPad.pool.numToAttrib;
for (let curRevNum = 0; curRevNum <= newRevHead; curRevNum++) {
const rev = await db.get(`pad:${padId}:revs:${curRevNum}`);
if (rev.meta) {
throw new Error('The specified revision number could not be found.');
}
if (!rev || !rev.meta) throw new Error('The specified revision number could not be found.');
const newRevNum = ++newPad.head;
const newRevId = `pad:${newPad.id}:revs:${newRevNum}`;
await Promise.all([