While Loop within For Loop crashes Game

Hello!
I want my Token spawn algorithm to not spawn more than 2 of the same type in a row. therefore i’m using a while loop within a for loop to check if the same color is within the spawn list more than 2 times.

I tried out several things but i can’t see why this would produce an infinite loop:

for (int i=0; i<_tokenList.Length; i++)
		{
			while (!canAddToken) {
			
			tokenToAdd = _tokenType[Random.Range(0,maxTokens)];
			createdTokenList.Add(tokenToAdd);
				
			lastTokenAmount = 0;

			foreach (string tokenToCheck in createdTokenList)
				{
					if (tokenToCheck == tokenToAdd)
					{
						lastTokenAmount += 1;
					}
					
				}
			
			if(lastTokenAmount > 2)
				{
					createdTokenList.Remove(tokenToAdd);
					canAddToken = false;
				}
			else
				{
					canAddToken = true;
				}
			
			}
		
			_tokenList *= tokenToAdd;*
  •  	canAddToken = false;*
    
  •  }*
    

for (int i=0; i<_tokenList.Length; i++)
{
while (!canAddToken) {

          tokenToAdd = _tokenType[Random.Range(0,maxTokens)];
 
          canAddToken = i<2 || !(tokenList[i-1] == tokenToAdd && tokenList[i-2] == tokenToAdd);
 
         }
 
         _tokenList *= tokenToAdd;*

canAddToken = false;

}