summaryrefslogtreecommitdiff
path: root/libs/gui/Surface.cpp
diff options
context:
space:
mode:
author Jesse Hall <jessehall@google.com> 2013-03-02 16:25:32 -0800
committer Jesse Hall <jessehall@google.com> 2013-03-02 20:06:42 -0800
commit006a601f22b275bcabf608f630b321df027d56d1 (patch)
treeccea1e25e075bf41df20f01ec080e30b1a49236a /libs/gui/Surface.cpp
parentbbb57f3331c7182399ed82e9c4f93a965677dde3 (diff)
Fix reading NULL Surfaces from Parcels
Writing a NULL Surface was being read as a non-NULL Surface with NULL mGraphicBufferProducer. Before the SurfaceTextureClient -> Surface refactoring, you'd get a NULL Surface, and some code relies on that. Bug: 8291161 Change-Id: I477bfe8882693e53a5f604a3d2c9e3cfe24473b4
Diffstat (limited to 'libs/gui/Surface.cpp')
-rw-r--r--libs/gui/Surface.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 410ad5da92..950d16a4f2 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -735,7 +735,7 @@ status_t Surface::writeToParcel(
sp<Surface> Surface::readFromParcel(const Parcel& data) {
sp<IBinder> binder(data.readStrongBinder());
sp<IGraphicBufferProducer> bp(interface_cast<IGraphicBufferProducer>(binder));
- return new Surface(bp);
+ return bp != NULL ? new Surface(bp): NULL;
}
// ----------------------------------------------------------------------------