summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/remote/bazel/bazel_response.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bazel_response.cpp')
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_response.cpp11
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 {}",