My teacher has been asked this many times. Actually, he was asked if it was okay to take medicine with alcohol in it if drinking alcohol violated a precept. His indication was yes, because really, otherwise you would not do so. There are people who are much stricter about this, of course. let nature take its course, and if I die, the so be it, at least I didn't violate any precept or intentionally kill any living being.
But this can also be a type of ego clinging, a kind of Buddhist martyrdom, thinking that one is maintaining some notion of perfect purity at any cost. But if you die from an easily treatable infection, how will you help other beings? And troubling the mind about it may just dig you in deeper.
If a person is really worried about it, they can do things such as releasing lives (worms from a bait store, for example) and thus free other beings who are intentionally intended for killing.
Even up the score, so to speak.
It's like a car in an accident, unless you really get a lot of pleasure from killing, hope to do it again, etc., the precept isn't really broken, maybe just "dented and scratched up" a little, and it can be "repaired".
That's why The Mahayana is called the great vehicle.