From 1d99674e5d5627ce49b51a7cd5b52c36a9738ad1 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 1 Oct 2019 16:30:54 -0700 Subject: [PATCH] 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 --- fs_mgr/libsnapshot/snapshot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp index 020007733..354aafa90 100644 --- a/fs_mgr/libsnapshot/snapshot.cpp +++ b/fs_mgr/libsnapshot/snapshot.cpp @@ -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)) {