You can combine the not-all-null check with the for-loop below --- there's no need for a helper function.