Commit c1850f0c authored by Sam McNally's avatar Sam McNally Committed by Commit Bot

Ensure BlobReader never returns a null blob_data.

Ensure |blob_data_| is always initialized on successful codepaths even
when OnDataAvailable() is never invoked.

Bug: 863788
Change-Id: I08d0d73fa2a99c3d0b229c05f1c23377eb72f0b3
Reviewed-on: https://chromium-review.googlesource.com/1137956Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575507}
parent 2f8bf816
...@@ -72,6 +72,8 @@ void BlobReader::OnDataAvailable(const void* data, size_t num_bytes) { ...@@ -72,6 +72,8 @@ void BlobReader::OnDataAvailable(const void* data, size_t num_bytes) {
void BlobReader::OnDataComplete() { void BlobReader::OnDataComplete() {
data_complete_ = true; data_complete_ = true;
if (!blob_data_)
blob_data_ = std::make_unique<std::string>();
if (blob_length_) if (blob_length_)
Succeeded(); Succeeded();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment