Change base::JSONReader::ReadToValue() to return Optional.
https://chromium-review.googlesource.com/c/chromium/src/+/1476186
This commit is contained in:
parent
fb9d1bd83c
commit
0243b0ffc1
1 changed files with 4 additions and 5 deletions
|
@ -186,16 +186,15 @@ bool Archive::Init() {
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string error;
|
||||
base::JSONReader reader;
|
||||
std::unique_ptr<base::Value> value(reader.ReadToValue(header));
|
||||
base::Optional<base::Value> 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<base::DictionaryValue*>(value.release()));
|
||||
header_ = base::DictionaryValue::From(
|
||||
std::make_unique<base::Value>(value->Clone()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue