From 748f3df66f6695681cde44461e2548e6e1dbc1bb Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 10 Aug 2012 14:36:40 -0700 Subject: [PATCH] avoid crashing when we don't have an h/w composer should fix the emulator Bug: 6956162 Change-Id: I38247b59d276b8db078c4dc2caba7d3fb545912c --- services/surfaceflinger/DisplayHardware/HWComposer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 909c30dcc..49aba5279 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -620,7 +620,7 @@ public: * 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),