In addition to proper sanitizing, whether I'm making beer or not, I keep the lid and the vent cover tightly on the fermenter so that no flies, insects or other univited guests get into the unit.
I hope that this never happens to me, but you can never be too careful!