fix: add self-assign check in operator=

Related-To: NEO-9038
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-10-02 13:31:29 +00:00
committed by Compute-Runtime-Automation
parent 16d94a0b8c
commit 9337911742
6 changed files with 26 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 Intel Corporation
* Copyright (C) 2019-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -30,6 +30,9 @@ class ConstStringRef {
}
ConstStringRef &operator=(const ConstStringRef &rhs) {
if (this == &rhs) {
return *this;
}
this->ptr = rhs.ptr;
this->len = rhs.len;
return *this;