From 0243b0ffc19db189ce5ba931cd47e74b434b8449 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 27 Feb 2019 17:35:27 +0530 Subject: [PATCH] Change base::JSONReader::ReadToValue() to return Optional. https://chromium-review.googlesource.com/c/chromium/src/+/1476186 --- atom/common/asar/archive.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/atom/common/asar/archive.cc b/atom/common/asar/archive.cc index 5684f95f6d72..1da683c21302 100644 --- a/atom/common/asar/archive.cc +++ b/atom/common/asar/archive.cc @@ -186,16 +186,15 @@ bool Archive::Init() { return false; } - std::string error; - base::JSONReader reader; - std::unique_ptr value(reader.ReadToValue(header)); + base::Optional value = base::JSONReader::Read(header); if (!value || !value->is_dict()) { - LOG(ERROR) << "Failed to parse header: " << error; + LOG(ERROR) << "Failed to parse header"; return false; } header_size_ = 8 + size; - header_.reset(static_cast(value.release())); + header_ = base::DictionaryValue::From( + std::make_unique(value->Clone())); return true; }