Changeset 3654 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Mar 25, 2005, 6:47:26 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/util/list.h
r3653 r3654 87 87 inline T* tIterator<T>::nextElement () 88 88 { 89 if( this->currentEl == NULL) 90 { 91 PRINTF(1)("Iterator has not been initialized - there is no currentEl\n"); 89 if( this->currentEl == NULL || this->currentEl->next == NULL) /* don't turn it the other way or it will give segfaults! */ 92 90 return NULL; 93 }94 91 if( this->currentEl == this->firstEl) 95 92 { 96 93 this->currentEl = this->currentEl->next; 97 return this->firstEl->curr; 98 } 99 if( this->currentEl->next == NULL) 100 return NULL; 94 return this->firstEl->curr; /* if its the first element, don't return second element*/ 95 } 101 96 this->currentEl = this->currentEl->next; 102 97 return this->currentEl->curr; … … 126 121 127 122 private: 128 129 123 Uint32 size; 130 124 listElement<T>* first; 131 125 listElement<T>* last; 132 126 listElement<T>* currentEl; 133 134 127 }; 135 128 … … 255 248 inline tIterator<T>* tList<T>::getIterator() 256 249 { 257 if( this->size == 0) return NULL;258 250 tIterator<T>* iterator = new tIterator<T>(this->first); 259 251 return iterator;
Note: See TracChangeset
for help on using the changeset viewer.