mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-18 16:26:31 +00:00
Berry assigment to list with negative index (#20537)
This commit is contained in:
parent
c0a78212a4
commit
06c2d78d5f
@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Web file upload response on upload error (#20340)
|
- Web file upload response on upload error (#20340)
|
||||||
- ESP32 shutter exception 6 (divide by zero) on ``ShutterMode 4`` (#20524)
|
- ESP32 shutter exception 6 (divide by zero) on ``ShutterMode 4`` (#20524)
|
||||||
- GPIOViewer exception 3
|
- GPIOViewer exception 3
|
||||||
|
- Berry assigment to list with negative index
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Max number of 30 backlog entries
|
- Max number of 30 backlog entries
|
||||||
|
@ -731,10 +731,13 @@ BERRY_API bbool be_getindex(bvm *vm, int index)
|
|||||||
static bvalue* list_setindex(blist *list, bvalue *key)
|
static bvalue* list_setindex(blist *list, bvalue *key)
|
||||||
{
|
{
|
||||||
int idx = var_toidx(key);
|
int idx = var_toidx(key);
|
||||||
if (idx < be_list_count(list)) {
|
if (idx < 0) {
|
||||||
return be_list_at(list, idx);
|
idx = list->count + idx;
|
||||||
}
|
}
|
||||||
|
if (idx < 0 || idx >= list->count) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
return be_list_at(list, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
BERRY_API bbool be_setindex(bvm *vm, int index)
|
BERRY_API bbool be_setindex(bvm *vm, int index)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user