diff options
author | Jamie Gennis <jgennis@google.com> | 2011-02-27 18:40:09 -0800 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2011-02-27 18:43:17 -0800 |
commit | a1c7e0e706bd32fec7a06456beccbdf090cb8c76 (patch) | |
tree | f44a535e6e73b8128dc9bb3a0e916de0f40ff5ad /libs | |
parent | 097d3a4729583276df166a1f8c0336d8ebafc566 (diff) | |
download | frameworks_base-a1c7e0e706bd32fec7a06456beccbdf090cb8c76.zip frameworks_base-a1c7e0e706bd32fec7a06456beccbdf090cb8c76.tar.gz frameworks_base-a1c7e0e706bd32fec7a06456beccbdf090cb8c76.tar.bz2 |
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
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaceflinger_client/Surface.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp index 1e9bd74..68611d6 100644 --- a/libs/surfaceflinger_client/Surface.cpp +++ b/libs/surfaceflinger_client/Surface.cpp @@ -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; } |