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

Commit bd9cbc3b authored by Jamie Gennis's avatar Jamie Gennis
Browse files

surfaceflinger_client: Don't dereference NULL ptrs.

This change adds a null pointer check before dereferencing buffers in
a Surface list of known GraphicBuffer objects.  If not all the buffers
have been dequeued before this list can legitimately contain NULL
entries.

Change-Id: I0e105b53a3f6f9a5404716b7bf150c793ff648a6
parent be566cb5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1040,7 +1040,7 @@ int Surface::getBufferIndex(const sp<GraphicBuffer>& buffer) const
        // e.g. if GraphicBuffer is used to wrap an android_native_buffer_t that
        // was dequeued from an ANativeWindow.
        for (size_t i = 0; i < mBuffers.size(); i++) {
            if (buffer->handle == mBuffers[i]->handle) {
            if (mBuffers[i] != 0 && buffer->handle == mBuffers[i]->handle) {
                idx = mBuffers[i]->getIndex();
                break;
            }