Revert^2 "libandroidfw hardening for IncFs"
55ef6167a2c235bd88c7216238b2001b46795b79
Change-Id: I02d4890d181655dfd0a14c188468db512559d27b
Merged-In: I02d4890d181655dfd0a14c188468db512559d27b
diff --git a/libs/androidfw/tests/TestHelpers.cpp b/libs/androidfw/tests/TestHelpers.cpp
index a81bb6f..10c0a4f 100644
--- a/libs/androidfw/tests/TestHelpers.cpp
+++ b/libs/androidfw/tests/TestHelpers.cpp
@@ -73,11 +73,15 @@
return AssertionFailure() << "table has no string pool for block " << block;
}
- const String8 actual_str = pool->string8ObjectAt(val.data);
- if (String8(expected_str) != actual_str) {
- return AssertionFailure() << actual_str.string();
+ auto actual_str = pool->string8ObjectAt(val.data);
+ if (!actual_str.has_value()) {
+ return AssertionFailure() << "could not find string entry";
}
- return AssertionSuccess() << actual_str.string();
+
+ if (String8(expected_str) != *actual_str) {
+ return AssertionFailure() << actual_str->string();
+ }
+ return AssertionSuccess() << actual_str->string();
}
} // namespace android