Commit 7b0bdf11 authored by Christos Froussios's avatar Christos Froussios Committed by Commit Bot

[Password Manager] Check for null database before migrating

When PasswordStoreDefault initialises the LoginDatabase, if the step fails,
it will set the database to null. In that case, PasswordStoreX should not
attempt to perform a migration.

Bug: 991213
Change-Id: Id31a65b228532c1206283f6af175f339efbb292b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1746167Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Christos Froussios <cfroussios@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686430}
parent 8563cdb7
...@@ -207,12 +207,18 @@ void PasswordStoreX::CheckMigration() { ...@@ -207,12 +207,18 @@ void PasswordStoreX::CheckMigration() {
if (migration_checked_) if (migration_checked_)
return; return;
migration_checked_ = true; migration_checked_ = true;
if (migration_to_login_db_step_ == LOGIN_DB_REPLACED) { if (migration_to_login_db_step_ == LOGIN_DB_REPLACED) {
return; return;
} }
if (!login_db()) {
LOG(ERROR) << "Could not start the migration into the encrypted "
"LoginDatabase because the database failed to initialise.";
return;
}
// If the db is empty, there are no records to migrate, and we then can call // If the db is empty, there are no records to migrate, and we then can call
// it a completed migration. // it a completed migration.
if (login_db()->IsEmpty()) { if (login_db()->IsEmpty()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment