Should inner loops reset their infinite loop counter?

I’m creating a mesh generator and have an outer loop for the y axis and in inner loop for the x axis.

The inner loop “counter” for tracking infinite loops isn’t getting reset on each iteration of the outer loop. This causes the infinite loop error to get generated.

I can fix it by moving the inner loop to a function, but that seems a bit tedious to have to do this for every nested loop.

Is this an intentional feature or an oversight?