summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author xuchengchen <xuchengchen@xiaomi.com> 2024-08-30 10:05:42 +0800
committer xuchengchen <xuchengchen@xiaomi.com> 2024-08-30 10:15:01 +0800
commit799a759d8948927770c3a2ee9fc5b5489f6dfa52 (patch)
tree92a6129dff393ecbb7dc31591733e00f79883e4e
parent754cf33bcef0d4a4c729152b3d9f540452e4cb1c (diff)
If the handle does not exist, it should return false
Test: size_type erase(const key_type& key) If the key does not exist, the return value is 0 Change-Id: Idf3bf9be6d99c748b634d08fb3edc5aa02c48240 Signed-off-by: xuchengchen <xuchengchen@xiaomi.com>
-rw-r--r--services/sensorservice/SensorEventConnection.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/sensorservice/SensorEventConnection.cpp b/services/sensorservice/SensorEventConnection.cpp
index dc8657759c..d5bfadbdc4 100644
--- a/services/sensorservice/SensorEventConnection.cpp
+++ b/services/sensorservice/SensorEventConnection.cpp
@@ -173,7 +173,7 @@ bool SensorService::SensorEventConnection::addSensor(int32_t handle) {
bool SensorService::SensorEventConnection::removeSensor(int32_t handle) {
Mutex::Autolock _l(mConnectionLock);
- if (mSensorInfo.erase(handle) >= 0) {
+ if (mSensorInfo.erase(handle) > 0) {
return true;
}
return false;