nil check
nil check and type safety