Whenever the Messenger of Allah ﷺ was called to a funeral, he would ask about the deceased. If the person was spoken of well, he would rise and pray over them. But if the person was spoken of otherwise, he would say to the family, "See to your own affair," and he would not pray over them.
حدثنا أبو النضر حدثنا إبراهيم بن سعد حدثني أبي عن عبد الله بن أبي قتادة عن أبيه فذكر نحوه