Merge "surfaceflinger_client: Don't dereference NULL ptrs."

This commit is contained in:
Mathias Agopian 2011-02-28 12:50:25 -08:00 committed by Android (Google) Code Review
commit 26f429d60e

View File

@ -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;
}