When something like this happens, it's always a series of oversights.
1. Someone forgot to add comments or test cases while writing the code (or perhaps he wrote it but people are not running the test cases before commits).
2. Someone else thought that the code is dead and deleted it (and skipped the test cases if there were some covering that particular scenario).
3. Either the person deleting the code didn't wait for the code review or code reviewers missed that as well. (If code reviews are non-existent, it's a disaster waiting to happen).
So in the hindsight, write comments, write test cases, run test cases and do code reviews carefully.