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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string error;
|
base::Optional<base::Value> value = base::JSONReader::Read(header);
|
||||||
base::JSONReader reader;
|
|
||||||
std::unique_ptr<base::Value> value(reader.ReadToValue(header));
|
|
||||||
if (!value || !value->is_dict()) {
|
if (!value || !value->is_dict()) {
|
||||||
LOG(ERROR) << "Failed to parse header: " << error;
|
LOG(ERROR) << "Failed to parse header";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
header_size_ = 8 + size;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue