The objective function $z=x+m y$ has a maximum value less than 2. Then the range of the real number $m$ is ( ).
(A) $(1,1+\sqrt{2})$
(B) $(1+\sqrt{2},+\infty)$
(C) $(1, \sqrt{2})$
(D) $(3,+\infty)$
2. A.

It is easy to know that the maximum value is taken at the intersection of $y=m x$ and $x+y=1$, at this point, the intersection is $A\left(\frac{1}{1+m}, \frac{m}{1+m}\right)$.
$$
\begin{aligned}
& \text { Hence } z_{\max }=\frac{1}{1+m}+\frac{m^{2}}{1+m}<2 \\
\Rightarrow & m^{2}-2 m-1<0 \\
\Rightarrow & 1<m<1+\sqrt{2} .
\end{aligned}
$$