avoid crashing when we don't have an h/w composer
should fix the emulator
Bug: 6956162
Change-Id: I38247b59d276b8db078c4dc2caba7d3fb545912c
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 909c30d..49aba52 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -620,7 +620,7 @@
* returns an iterator initialized at a given index in the layer list
*/
HWComposer::LayerListIterator HWComposer::getLayerIterator(int32_t id, size_t index) { // FIXME: handle multiple displays
- if (index > hwcNumHwLayers(mHwc, mLists[0]))
+ if (!mHwc || index > hwcNumHwLayers(mHwc, mLists[0]))
return LayerListIterator();
if (hwcHasVersion(mHwc, HWC_DEVICE_API_VERSION_1_0)) {
return LayerListIterator(new HWCLayerVersion1(mLists[0]->hwLayers),