SurfaceComposerClient: Fix potential null de-reference in detachChildren
We return from the function when we know the pointer is null to
avoid dereferencing it.
Test: TreeHugger
Change-Id: I487b71ba185a48b505719a14b38b8a60283e10a7
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index a0ed940..01bfe2a 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -1051,6 +1051,7 @@
layer_state_t* s = getLayerState(sc);
if (!s) {
mStatus = BAD_INDEX;
+ return *this;
}
s->what |= layer_state_t::eDetachChildren;