From 8dceb45567a215c60c54da9889be9d4a74d7ca7a Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Sun, 4 Jul 2004 14:59:21 +0000 Subject: [PATCH] fixed bug in CList::put --- amxmodx/CList.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/amxmodx/CList.h b/amxmodx/CList.h index 3f68602f..de523c1a 100755 --- a/amxmodx/CList.h +++ b/amxmodx/CList.h @@ -252,18 +252,20 @@ public: } // puts an element after where - // sets where to point to the new element + // alters where to point to the new element // returns an iterator pointing to the new element - iterator put(T *pObj, iterator where) + iterator put(T *pObj, iterator &where) { CElement *pTmp = new CElement(pObj); - if (where.m_pNext) - where.m_pNext->m_pPrev = pTmp; + if (where.m_CurPos->GetNext()) + where.m_CurPos->GetNext()->SetPrev(pTmp); else // where = tail - m_pTail = pObj; - where.m_pNext = pTmp; + m_pTail = pTmp; + pTmp->SetPrev(where.m_CurPos); - pTmp->SetNext(where.m_pNext->m_CurPos); + pTmp->SetNext(where.m_CurPos->GetNext()); + + where.m_CurPos->SetNext(pTmp); return ++where; }