Add explicit Result::ok() checks where needed

Test: m checkbuild continuous_instrumentation_tests continuous_instrumentation_tests_api_coverage continuous_native_tests device-tests platform_tests
Exempt-From-Owner-Approval: mechanical mass refactoring
Change-Id: I3117833c51cdb333cccdfd159d1582f2adef77db
This commit is contained in:
Bernie Innocenti
2020-12-19 15:31:52 +09:00
parent 96db3dad2a
commit 58cf8e3ffa
6 changed files with 16 additions and 12 deletions

View File

@@ -71,7 +71,7 @@ Result<ResourceId> WARN_UNUSED ParseResReference(const AssetManager2& am, const
}
// next, try to parse as a package:type/name string
if (auto resid = am.GetResourceId(res, "", fallback_package)) {
if (auto resid = am.GetResourceId(res, "", fallback_package); resid.ok()) {
return *resid;
}
@@ -94,7 +94,7 @@ void PrintValue(AssetManager2* const am, const AssetManager2::SelectedValue& val
case Res_value::TYPE_STRING: {
const ResStringPool* pool = am->GetStringPoolForCookie(value.cookie);
out->append("\"");
if (auto str = pool->string8ObjectAt(value.data)) {
if (auto str = pool->string8ObjectAt(value.data); str.ok()) {
out->append(*str);
}
} break;

View File

@@ -98,7 +98,7 @@ Result<std::string> XmlParser::Node::GetAttributeStringValue(const std::string&
switch ((*value).dataType) {
case Res_value::TYPE_STRING: {
if (auto str = parser_.getStrings().string8ObjectAt((*value).data)) {
if (auto str = parser_.getStrings().string8ObjectAt((*value).data); str.ok()) {
return std::string(str->string());
}
break;