diff options
author | 2021-07-13 01:09:26 +0000 | |
---|---|---|
committer | 2021-07-13 01:14:10 +0000 | |
commit | 42454986b60bf717e377cb6bb2ba68c825d284be (patch) | |
tree | eedf380ccf8dbcb248de935edaf0a3ef5cbfc607 /libs/binder/Status.cpp | |
parent | d195645e36da06189b1df4c8231f177d01466923 (diff) |
libbinder: Status - allow null errors
Java Throwable getMessage can (and will!) return null, and when this
happens, we don't get any error information in the native world. So, for
instance, Java ServiceException won't be reported to native code.
This is technically a backwards incompatible change, and we'll have to
watch for breakages, but losing service specific exceptions in such a
clearly egregious way is not acceptable. :)
Fixes: 178861468
Test: boot & aidl_integration_test
Change-Id: If70d8fb445078c2989c4288c01055bb7191a012f
Diffstat (limited to 'libs/binder/Status.cpp')
-rw-r--r-- | libs/binder/Status.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/binder/Status.cpp b/libs/binder/Status.cpp index b5a078c4c0..a44c578230 100644 --- a/libs/binder/Status.cpp +++ b/libs/binder/Status.cpp @@ -130,13 +130,13 @@ status_t Status::readFromParcel(const Parcel& parcel) { } // The remote threw an exception. Get the message back. - String16 message; + std::optional<String16> message; status = parcel.readString16(&message); if (status != OK) { setFromStatusT(status); return status; } - mMessage = String8(message); + mMessage = String8(message.value_or(String16())); // Skip over the remote stack trace data int32_t remote_stack_trace_header_size; |