diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2020-11-16 23:08:18 +0000 |
---|---|---|
committer | Ryan Mitchell <rtmitchell@google.com> | 2020-11-17 23:01:35 +0000 |
commit | db21f09a8e02bcfd3fefea68084667688268f1fa (patch) | |
tree | c9b22a2676936eaf56ee1160c9349632ccd7ba44 /libs/androidfw/tests/TestHelpers.cpp | |
parent | 687f5e163f24ff31f822f986fd7a99b8832b6286 (diff) |
Revert^2 "libandroidfw hardening for IncFs"
55ef6167a2c235bd88c7216238b2001b46795b79
Change-Id: I02d4890d181655dfd0a14c188468db512559d27b
Diffstat (limited to 'libs/androidfw/tests/TestHelpers.cpp')
-rw-r--r-- | libs/androidfw/tests/TestHelpers.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/androidfw/tests/TestHelpers.cpp b/libs/androidfw/tests/TestHelpers.cpp index a81bb6ffab06..10c0a4fc8316 100644 --- a/libs/androidfw/tests/TestHelpers.cpp +++ b/libs/androidfw/tests/TestHelpers.cpp @@ -73,11 +73,15 @@ AssertionResult IsStringEqual(const ResTable& table, uint32_t resource_id, 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 |