Fix nullptr access when cow reader open fails

Bug: 260805150
Test: th
Change-Id: Id945cc4fa0fce141e3d52b8259241e22ba590ebd
This commit is contained in:
Kelvin Zhang 2022-12-02 09:50:44 -08:00
parent ccf13942e0
commit bc1a5b1393
1 changed files with 3 additions and 0 deletions

View File

@ -93,6 +93,9 @@ bool CompressedSnapshotWriter::VerifyMergeOps() const noexcept {
std::unique_ptr<FileDescriptor> CompressedSnapshotWriter::OpenReader() { std::unique_ptr<FileDescriptor> CompressedSnapshotWriter::OpenReader() {
auto cow = OpenCowReader(); auto cow = OpenCowReader();
if (cow == nullptr) {
return nullptr;
}
auto reader = std::make_unique<CompressedSnapshotReader>(); auto reader = std::make_unique<CompressedSnapshotReader>();
if (!reader->SetCow(std::move(cow))) { if (!reader->SetCow(std::move(cow))) {