Check for array value before reference