diff --git a/src/util/src/tskiplist.c b/src/util/src/tskiplist.c index 73f6bf0502102ebc0c37314914c31a89543482fe..c3e8ee41bd92a8766dcd9f9baf969c800d716f10 100644 --- a/src/util/src/tskiplist.c +++ b/src/util/src/tskiplist.c @@ -466,7 +466,12 @@ static bool tSkipListGetPosToPut(SSkipList *pSkipList, SSkipListNode **forward, } SSkipListNode *px = pSkipList->pHead; - for (int i = pSkipList->level - 1; i >= 0; --i) { + for (int i = pNode->level - 1; i >= 0; --i) { + if (i >= pSkipList->level) { + forward[i] = pSkipList->pHead; + continue; + } + SSkipListNode *p = SL_GET_FORWARD_POINTER(px, i); while (p != pSkipList->pTail) { pKey = SL_GET_NODE_KEY(pSkipList, p);