I'll keep my general argument here since I will eventually scrub those comments.
First, please observe this portion of the FAQ:
I'm confused! What questions are on-topic for this site?
Simply ask yourself the following questions. To be on-topic the answer must be yes to all questions:
- Does my question contain code? (Please include the code in the
question, not a link to it)
- Did I write that code?
- Is it actual code from a project rather than pseudo-code or example code?
- Do I want the code to be good code, (i.e. not code-golfing, obfuscation, or similar)
- To the best of my knowledge, does the code work?
- Do I want feedback about any or all facets of the code?
Point #5 suggests that if you first present your code without knowing about bugs beforehand, you may ask the question. This is different from SO in that answers primarily revolve around fixing bugs found by the OP. Here, code is not automatically off-topic if bugs are found afterwards.
Your question suggests no awareness of bugs. Overall, your question is on-topic. Someone eventually found bugs which, again, is okay here. As this answer is justified in accordance to the FAQ, it can remain. On the flip side, had you been aware of this bug, and someone fixed it anyway, that answer could be justifiably converted to a comment. But that doesn't apply here.
Overall, answer invalidation is never okay if the answer can justifiably remain. This is an SE-wide policy as answers are considered "permanent." It doesn't matter if visitors want the best code. Even then, that doesn't make sense in regards to reviewing. Code will almost always contain flaws. Do you want visitors to copy-paste working, but poor code? If it didn't matter, then answers could just be thrown away at a whim if the OP modifies the code. Sure, comments are fair game, but not valid answers.