You're absolutely right. It is very bad form to divide by zero and it is a very good thing that you noticed that problem.
As was already pointed out in the other answers and comments, in the present situation this isn't too bad, as it doesn't lead to a wrong conclusion, but this is rather an accident than good and careful reasoning. Were I to grade this solution, the textbook author wouldn't get full marks for that (assuming that what you display is the entire explanation).
It would have been much better to start with AlbertH's observation, so that's how I would have written the solution:
We would like to divide by $\cos{(2\theta)}$ in order to get the tangent on the left hand side. In order to do this, we should exclude the possibility that $\cos{(2\theta)} = 0$. Since $\sin^{2}{(2\theta)} + \cos^{2}{(2\theta)} = 1$, we conclude from $\cos{(2\theta)} = 0$ that $\sin{(2\theta)} = \pm 1$. Thus, we would have $\pm 2 = 2 \sin{(2\theta)} \neq \cos{(2\theta)} = 0$, so the given equation is not satisfied, and we can exclude $\cos{(2\theta)} = 0$. Now we may divide by $\cos{(2\theta)}$ and we get $1 = \frac{2 \sin{(2\theta)}}{\cos{(2\theta)}} = 2 \tan{2\theta}$ and thus $\tan{(2\theta)} = \frac{1}{2}$ as desired.