Merge "BufferQueueProducer: Slot may have null buffer [2/2]." into rvc-dev am: d3a385b3dd am: 93c8a6f226

Change-Id: I10a7a701af561185528bf47a58789f38d24e1830
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 520d0be..a7cf39a 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -1121,8 +1121,9 @@
         mCore->mFreeBuffers.push_back(slot);
     }
 
-    if (mCore->mConsumerListener != nullptr) {
-        mCore->mConsumerListener->onFrameCancelled(mSlots[slot].mGraphicBuffer->getId());
+    auto gb = mSlots[slot].mGraphicBuffer;
+    if (mCore->mConsumerListener != nullptr && gb != nullptr) {
+        mCore->mConsumerListener->onFrameCancelled(gb->getId());
     }
     mSlots[slot].mFence = fence;
     mCore->mDequeueCondition.notify_all();