The Prophet ﷺ said, "Whoever consoles one stricken by misfortune shall have a reward equal to his."
حدثنا يوسف بن عيسى حدثنا علي بن عاصم قال حدثنا والله محمد بن سوقة عن إبراهيم عن الأسود
عن النبي ﷺ قال من عزى مصابا فله مثل أجره
Its isnad is daif. Ibn Majah also narrated it in the Book of Funerals, Chapter on What Has Been Said About the Reward of One Who Consoles a Bereaved Person, hadith no. 1602, from the hadith of Ali bin Asim, with this same wording. Bayhaqi said, "Ali bin Asim narrated it alone, and this is one of the things he has been criticized for. It has been narrated from others as well, and it has daif corroborating narrations." See Talkhis Habir, 2/138, no. 799, and elsewhere.