Fix libgui cts crash bug
While enabling #define LOG_NDEBUG 0, run camera cts test command:
run cts -m CtsCameraTestCases -t android.hardware.camera2.cts.MultiViewTest#testSharedSurfaceImageReaderSwitch
the libgui will crash due to nullptr, fix this by add nullptr
judgement when pointing to the Graphicbuffer handle
Bug: 228349805
Signed-off-by: tangcheng <tangcheng@xiaomi.com>
Change-Id: I69a84bdb5208b16df88f5f09f45c1a93ad2afe01
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 5fe5e71..2d56dd3 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -606,7 +606,8 @@
BQ_LOGV("dequeueBuffer: returning slot=%d/%" PRIu64 " buf=%p flags=%#x",
*outSlot,
mSlots[*outSlot].mFrameNumber,
- mSlots[*outSlot].mGraphicBuffer->handle, returnFlags);
+ mSlots[*outSlot].mGraphicBuffer != nullptr ?
+ mSlots[*outSlot].mGraphicBuffer->handle : nullptr, returnFlags);
if (outBufferAge) {
*outBufferAge = mCore->mBufferAge;