Why the double if block? just return 0 at the end of the function.