For the more general case, let $x,y$ be arbitrary integers, and let $z = \gcd(x,y)$. Then, if $z$ does not evenly divide $c$, there is no pair of integers $(a,b)$ that satisfy $ax+by=c$. This is because in $\bmod z$, the left side of the equation is congruent to $0$ while the right side is not.
Your example is - at least, technically - not wrong, though one might argue that you have trivialized the problem, since setting $y = 0$ removes the $by$ term, and of course $\gcd(x,0)$ is undefined since there is no such thing as a GCD of $x$ and $0$ (see this post). Another counterexample would be something like $(x,y,z) = (21,14,5)$. Here, $\gcd(21,14) = 7$, and $7$ does not divide $5$, and therefore there is no pair of integers $(a,b)$ that satisfy the equation.