summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueueProducer.cpp
diff options
context:
space:
mode:
author Robert Carr <racarr@google.com> 2020-04-20 13:26:31 -0700
committer Robert Carr <racarr@google.com> 2020-04-20 13:26:31 -0700
commitfc069ba55fe88ba10d13fdc407fa4704dff64b87 (patch)
tree26800bb3aab97f73b6f84256f50d2b4275884fff /libs/gui/BufferQueueProducer.cpp
parent9bb4cfb009f1317605e8ff090e0ce930e15d4d40 (diff)
BufferQueueProducer: Slot may have null buffer
I'm not entirely sure how we got in to this state but it seems best not to crash. It seems like we are tearing down and everything will work out in the end anyway. Bug: 153913134 Test: Existing tests pass Change-Id: I1d21fa5f29ca1478ecf8e7cd6363f6f176ae9bee
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
-rw-r--r--libs/gui/BufferQueueProducer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 3f4c5da193..520d0beb43 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -655,8 +655,9 @@ status_t BufferQueueProducer::detachBuffer(int slot) {
}
listener = mCore->mConsumerListener;
- if (listener != nullptr) {
- listener->onFrameDetached(mSlots[slot].mGraphicBuffer->getId());
+ auto gb = mSlots[slot].mGraphicBuffer;
+ if (listener != nullptr && gb != nullptr) {
+ listener->onFrameDetached(gb->getId());
}
mSlots[slot].mBufferState.detachProducer();
mCore->mActiveBuffers.erase(slot);