In the absence of a priest or deacon, any lay Catholic has the right to baptise a dying man
Actually anyone can baptise in cases of necessity, even if they are not Catholic, or Christian in any way. I have to admit that I have always been a bit baffled by this fact.
I assume that the person, if adult, being baptized has requested it. But since God Himself has commanded it, the act has the desired effect more or less as dropping a stone results in it hitting the ground.