summaryrefslogtreecommitdiff
path: root/libs/androidfw/ResourceUtils.cpp
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2021-01-21 14:57:51 -0800
committerScott Lobdell <slobdell@google.com>2021-01-22 13:24:00 -0800
commit7fd6edc3a3ff37a750641d5e192835fe217f6050 (patch)
tree4369f3a76ed7ba782801984a51f7badb159a43c9 /libs/androidfw/ResourceUtils.cpp
parentd1a606fc7dfdbd4a3ded9d384a2b14f36f348c51 (diff)
parentd462c4768522d0a62f3bc6cf08158ac813bc09e6 (diff)
Merge SP1A.210105.001
Change-Id: Iebfaf27bb339a99d9303a53e6c2c397b0001c814
Diffstat (limited to 'libs/androidfw/ResourceUtils.cpp')
-rw-r--r--libs/androidfw/ResourceUtils.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/androidfw/ResourceUtils.cpp b/libs/androidfw/ResourceUtils.cpp
index a34aa7239250..87fb2c038c9f 100644
--- a/libs/androidfw/ResourceUtils.cpp
+++ b/libs/androidfw/ResourceUtils.cpp
@@ -56,7 +56,8 @@ base::expected<AssetManager2::ResourceName, NullOrIOError> ToResourceName(
.package_len = package_name.size(),
};
- if (base::expected<StringPiece, NullOrIOError> type_str = type_string_ref.string8()) {
+ if (base::expected<StringPiece, NullOrIOError> type_str = type_string_ref.string8();
+ type_str.ok()) {
name.type = type_str->data();
name.type_len = type_str->size();
} else if (UNLIKELY(IsIOError(type_str))) {
@@ -64,7 +65,8 @@ base::expected<AssetManager2::ResourceName, NullOrIOError> ToResourceName(
}
if (name.type == nullptr) {
- if (base::expected<StringPiece16, NullOrIOError> type16_str = type_string_ref.string16()) {
+ if (base::expected<StringPiece16, NullOrIOError> type16_str = type_string_ref.string16();
+ type16_str.ok()) {
name.type16 = type16_str->data();
name.type_len = type16_str->size();
} else if (!type16_str.has_value()) {
@@ -72,7 +74,8 @@ base::expected<AssetManager2::ResourceName, NullOrIOError> ToResourceName(
}
}
- if (base::expected<StringPiece, NullOrIOError> entry_str = entry_string_ref.string8()) {
+ if (base::expected<StringPiece, NullOrIOError> entry_str = entry_string_ref.string8();
+ entry_str.ok()) {
name.entry = entry_str->data();
name.entry_len = entry_str->size();
} else if (UNLIKELY(IsIOError(entry_str))) {
@@ -80,7 +83,8 @@ base::expected<AssetManager2::ResourceName, NullOrIOError> ToResourceName(
}
if (name.entry == nullptr) {
- if (base::expected<StringPiece16, NullOrIOError> entry16_str = entry_string_ref.string16()) {
+ if (base::expected<StringPiece16, NullOrIOError> entry16_str = entry_string_ref.string16();
+ entry16_str.ok()) {
name.entry16 = entry16_str->data();
name.entry_len = entry16_str->size();
} else if (!entry16_str.has_value()) {