Use a guard to check if a valid base is given to Integer.parse/2