PID integral help

I have a doubt about the integral value in code i found online…

The integral is the sum of all the error throughout the program correct?

So here is my doubt, For a line follower robot wont the Integral affect the equation drastically over time?

To a point where its completely stops the robot?

Here is the code

oid calculate_pid()
{
    P = error;
    I = I + error;
    D = error – previous_error;
    
    PID_value = (Kp*P) + (Ki*I) + (Kd*D);
    
    previous_error=error;
}

Than you!

So here is my doubt, For a line follower robot wont the Integral affect the equation drastically over time?

To a point where its completely stops the robot?

No, because sometimes error is positive and sometimes it is negative.

Oh right!

Thank you!