avoid crashing when we don't have an h/w composer

should fix the emulator

Bug: 6956162
Change-Id: I38247b59d276b8db078c4dc2caba7d3fb545912c
This commit is contained in:
Mathias Agopian 2012-08-10 14:36:40 -07:00
parent 3165cc21cf
commit 748f3df66f

View File

@ -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),