Container list add undefined check in Get

Issue: https://gitee.com/openharmony/commonlibrary_ets_utils/issues/IB553X

Signed-off-by: yaoyuan <yuanyao14@huawei.com>
Change-Id: I2c8516fc3a5b206d6dc92b39642c23f1243c10ef
This commit is contained in:
yaoyuan 2024-11-18 16:44:36 +08:00
parent fbffb6d0e0
commit 0f1447bdb7

View File

@ -143,7 +143,7 @@ if (flag || fastList === undefined) {
for (let i: number = 0; i < index && current !== undefined; i++) {
current = current.next;
}
return current.element;
return current && current.element;
}
return undefined;
}