From 000c7b8e6d72684116890933f8164b4debc25aab Mon Sep 17 00:00:00 2001 From: pwx1285814 Date: Fri, 30 Aug 2024 18:22:05 +0800 Subject: [PATCH] =?UTF-8?q?CleanCode=E6=B8=85=E7=90=86,=E5=AF=B9=E6=8C=87?= =?UTF-8?q?=E9=92=88=E8=BF=9B=E8=A1=8C=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pwx1285814 --- .../screenregionmgr/2.0/src/screenregion.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregion.cpp b/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregion.cpp index 67054c74..410fcb0b 100644 --- a/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregion.cpp +++ b/services/screenservice/sinkservice/screenregionmgr/2.0/src/screenregion.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -276,7 +276,21 @@ void ScreenRegion::OnEngineMessage(const std::shared_ptr &messag void ScreenRegion::GetWSBuffer(sptr &wsBuffer, const std::shared_ptr &buffer) { + if ((wsBuffer == nullptr) || (buffer == nullptr)) { + DHLOGE("wsBuffer or buffer is nullptr."); + return; + } + + if ((videoParam_ == nullptr) || (windowSurface_ == nullptr)) { + DHLOGE("videoParam or windowSurface is nullptr."); + return; + } + auto bufferData = buffer->GetBufferData(0); + if (bufferData == nullptr) { + DHLOGE("bufferData is null."); + return; + } auto bufferAddr = bufferData->GetAddress(); auto wsBufAddr = static_cast(wsBuffer->GetVirAddr()); uint32_t wsBufSize = wsBuffer->GetSize(); -- Gitee