From b3c6d3572784575811ff130d859e92b799e77bb3 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Tue, 25 Feb 2025 11:46:51 +0100 Subject: ArtifactBlob: Check access to the content --- src/buildtool/execution_api/remote/bazel/bazel_response.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.cpp') diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp index a0a621a4..f06a4275 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp @@ -67,7 +67,9 @@ auto BazelResponse::ReadStringBlob(bazel_re::Digest const& id) noexcept if (digest.has_value()) { auto reader = network_->CreateReader(); if (auto blob = reader.ReadSingleBlob(*digest)) { - return *blob->ReadContent(); + if (auto const content = blob->ReadContent()) { + return *content; + } } } Logger::Log(LogLevel::Warning, @@ -239,8 +241,11 @@ auto BazelResponse::Populate() noexcept -> std::optional { for (auto tree_blobs : reader.ReadIncrementally(&tree_digests)) { for (auto const& tree_blob : tree_blobs) { try { - auto tree = BazelMsgFactory::MessageFromString( - *tree_blob.ReadContent()); + std::optional tree; + if (auto const content = tree_blob.ReadContent()) { + tree = BazelMsgFactory::MessageFromString( + *content); + } if (not tree) { return fmt::format( "BazelResponse: failed to create Tree for {}", -- cgit v1.2.3