If $f(x)=\left\{\begin{array}{ll}\sin x \neq n \pi, n \in Z \\ 0, & \text { otherwise }\end{array}\right.$ and $g(x)=\left\{\begin{array}{ll}x^2+1, & x \neq 0,2 \\ 4, & x=0 \\ 5, & x=2\end{array}\right.$, then $\lim _{x \rightarrow 0} g\{f(x)\}$ is equal to
(A) 1
(B) 0
(C) $\frac{1}{2}$
(D) $\frac{1}{4}$