Close the database if the password is incorrect, fixes windows crash

pull/236/head
Beaudan 6 years ago
parent 98aa53de07
commit d317b020f0

@ -679,13 +679,21 @@ async function initialize({ configDir, key }) {
// console._log(`EXPLAIN QUERY PLAN ${statement}\n`, data && data.detail); // console._log(`EXPLAIN QUERY PLAN ${statement}\n`, data && data.detail);
// }); // });
await setupSQLCipher(promisified, { key }); try {
await updateSchema(promisified); await setupSQLCipher(promisified, { key });
await updateSchema(promisified);
} catch (e) {
await promisified.close();
throw e;
}
db = promisified; db = promisified;
} }
async function close() { async function close() {
if (!db) {
return;
}
const dbRef = db; const dbRef = db;
db = null; db = null;
await dbRef.close(); await dbRef.close();

Loading…
Cancel
Save