This should have been checked earlier. That way, you could get rid of the try-catch block.