mirror of https://github.com/arendst/Tasmota.git
Fix LList insertAt skipping one entry
This commit is contained in:
parent
7f5e79415f
commit
79bc9a6b94
|
@ -208,6 +208,10 @@ T & LList<T>::addToLast(void) {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T & LList<T>::insertAt(size_t index) {
|
T & LList<T>::insertAt(size_t index) {
|
||||||
|
if (0 == index) {
|
||||||
|
return addHead(); // insert at the head
|
||||||
|
}
|
||||||
|
index--;
|
||||||
LList_elt<T> **curr_ptr = &_head;
|
LList_elt<T> **curr_ptr = &_head;
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
while (*curr_ptr) {
|
while (*curr_ptr) {
|
||||||
|
|
Loading…
Reference in New Issue