From 5614ca04327d6c1db2dbaccee20f9c52fa4a95e4 Mon Sep 17 00:00:00 2001 From: tangcheng Date: Thu, 7 Apr 2022 14:26:05 +0800 Subject: 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 Change-Id: I69a84bdb5208b16df88f5f09f45c1a93ad2afe01 --- libs/gui/BufferQueueProducer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libs/gui/BufferQueueProducer.cpp') diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 5fe5e71db9..2d56dd37c2 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -606,7 +606,8 @@ status_t BufferQueueProducer::dequeueBuffer(int* outSlot, sp* ou 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; -- cgit v1.2.3-59-g8ed1b