Checking infinity value to avoid breaking the progressbar