Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7ee5916 authored by Sushil Chauhan's avatar Sushil Chauhan Committed by Arne Coucheron
Browse files

SurfaceFlinger.cpp: Check for NULL in removeLayer()

The patch checks for NULL in removeLayer() to avoid NULL pointer
exception in removeLayer_l().

Change-Id: I92d60d46039ebb1c73b18cf1d7036d00c7df78f2
CRs-Fixed: 294458
parent 9f3cd90b
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -1081,10 +1081,13 @@ ssize_t SurfaceFlinger::addClientLayer(const sp<Client>& client,

status_t SurfaceFlinger::removeLayer(const sp<LayerBase>& layer)
{
    status_t err = NAME_NOT_FOUND;
    Mutex::Autolock _l(mStateLock);
    status_t err = purgatorizeLayer_l(layer);
    if (layer != 0) {
        err = purgatorizeLayer_l(layer);
        if (err == NO_ERROR)
            setTransactionFlags(eTransactionNeeded);
    }
    return err;
}

@@ -1105,7 +1108,7 @@ status_t SurfaceFlinger::removeLayer_l(const sp<LayerBase>& layerBase)
status_t SurfaceFlinger::purgatorizeLayer_l(const sp<LayerBase>& layerBase)
{
    // remove the layer from the main list (through a transaction).
    ssize_t err = removeLayer_l(layerBase);
    status_t err = removeLayer_l(layerBase);

    layerBase->onRemoved();