Let's not divide by zero.
Guess what: exceptions can be avoided here! durrr.
Set the goal to 0 if the input value is invalid.