Use a validation check instead of null check