diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-25 11:46:51 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-27 09:03:30 +0100 |
commit | b3c6d3572784575811ff130d859e92b799e77bb3 (patch) | |
tree | dc37456d28fa9e464bdd50eb3218a6917c73e4be /src/buildtool/execution_api/remote/bazel/bazel_response.cpp | |
parent | 9a987188a38cc18f6a485bd5def16aded10fe1f6 (diff) | |
download | justbuild-b3c6d3572784575811ff130d859e92b799e77bb3.tar.gz |
ArtifactBlob: Check access to the content
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.cpp')
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bazel_response.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
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<std::string> { for (auto tree_blobs : reader.ReadIncrementally(&tree_digests)) { for (auto const& tree_blob : tree_blobs) { try { - auto tree = BazelMsgFactory::MessageFromString<bazel_re::Tree>( - *tree_blob.ReadContent()); + std::optional<bazel_re::Tree> tree; + if (auto const content = tree_blob.ReadContent()) { + tree = BazelMsgFactory::MessageFromString<bazel_re::Tree>( + *content); + } if (not tree) { return fmt::format( "BazelResponse: failed to create Tree for {}", |