I am trying to understand and implement hash tables using linear probing. While searching for an implementation I have come across this piece of code for a search method: 

```
struct DataItem *search(int key) {
   //get the hash 
   int hashIndex = hashCode(key);

   //move in array until an empty 
   while(hashArray[hashIndex] != NULL) {

      if(hashArray[hashIndex]->key == key)
         return hashArray[hashIndex];

      //go to next cell
      ++hashIndex;

      //wrap around the table
      hashIndex %= SIZE;
   }

   return NULL;        
}

```

What I don't understand is if all the entries in the hashArray are already occupied by a key, shouldn't the while loop become infinite? or does this never happen? Is there something I am missing?