camera2: fix an error reading a NULL string
Handle the case where the surface name isn't set.
Bug: 10461464
Change-Id: I3ee233a7a5f6489513e6d87241cda2aaefbfd43b
diff --git a/camera/camera2/CaptureRequest.cpp b/camera/camera2/CaptureRequest.cpp
index 57e5319..fb74c8d 100644
--- a/camera/camera2/CaptureRequest.cpp
+++ b/camera/camera2/CaptureRequest.cpp
@@ -63,9 +63,9 @@
}
// Surface.writeToParcel
- String16 name = parcel->readString16();
- ALOGV("%s: Read surface name = %s",
- __FUNCTION__, String8(name).string());
+ const char16_t* name = parcel->readString16Inplace(&len);
+ ALOGV("%s: Read surface name = %s", __FUNCTION__,
+ name != NULL ? String8(name).string() : "<null>");
sp<IBinder> binder(parcel->readStrongBinder());
ALOGV("%s: Read surface binder = %p",
__FUNCTION__, binder.get());