libsnapshot: Skip initializing snapshot if not created.

If no opeartions is to be executed on a partition, it is
possible that no snapshot is created for it. In that case,
don't crash when initalizing snapshots.

Test: libsnapshot_test
Change-Id: I7bb0b5596aa6e4eca319e9c88f6552d1907a6944
This commit is contained in:
Yifan Hong 2019-10-01 16:30:54 -07:00
parent 55fb297a0c
commit 1d99674e5d

View file

@ -1977,7 +1977,7 @@ bool SnapshotManager::InitializeUpdateSnapshots(
}
auto it = all_snapshot_status.find(target_partition->name());
CHECK(it != all_snapshot_status.end()) << target_partition->name();
if (it == all_snapshot_status.end()) continue;
cow_params.partition_name = target_partition->name();
std::string cow_name;
if (!MapCowDevices(lock, cow_params, it->second, &created_devices_for_cow, &cow_name)) {