From b2884b50cbebab9f1950a5f8577a714b4809fcab Mon Sep 17 00:00:00 2001 From: li-tiangang4 Date: Thu, 6 Feb 2025 15:52:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=91=8A=E8=AD=A6=EF=BC=8C?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E4=B8=8A=E4=B8=8B=E9=99=90=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E6=95=B0=E7=BB=84=E4=B8=8B=E6=A0=87=E8=B6=8A=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-tiangang4 --- .../src/distributed_input_handler.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/inputdevicehandler/src/distributed_input_handler.cpp b/inputdevicehandler/src/distributed_input_handler.cpp index 2a5f7bd..4597623 100644 --- a/inputdevicehandler/src/distributed_input_handler.cpp +++ b/inputdevicehandler/src/distributed_input_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 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 @@ -197,14 +197,14 @@ void DistributedInputHandler::StartInputMonitorDeviceThread() } while (isCollectingEvents_) { size_t count = inputHub_->StartCollectInputHandler(mEventBuffer_, inputDeviceBufferSize_); - if (count > 0) { - DHLOGI("Count: %{public}zu", count); - for (size_t iCnt = 0; iCnt < count; iCnt++) { - NotifyHardWare(iCnt); - } - } else { + DHLOGI("count: %{public}zu", count); + if (count == 0 || count > inputDeviceBufferSize_) { + DHLOGE("Collect input device size is invaild."); continue; } + for (size_t iCnt = 0; iCnt < count; iCnt++) { + NotifyHardWare(iCnt); + } } isCollectingEvents_ = false; DHLOGI("DistributedInputHandler::StartCollectEventsThread exit!"); -- Gitee