hwc: NULL check on buffer handle
In some cases it is seen that we receive a NULL handle on
suspend/resume. One such test case is open browser, suspend
device, resume device, unlock screen. Since we rely on the handle
to get the format, make sure it is not null.
Change-Id: Ia476887a831df33a50b2939a46c143b9c207ea9b
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 5018d2e..12a543b 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -291,13 +291,15 @@
bool isAlphaPresent(hwc_layer_1_t const* layer) {
private_handle_t *hnd = (private_handle_t *)layer->handle;
- int format = hnd->format;
- switch(format) {
+ if(hnd) {
+ int format = hnd->format;
+ switch(format) {
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_BGRA_8888:
// In any more formats with Alpha go here..
return true;
default : return false;
+ }
}
return false;
}