It is narrated from Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Whoever consoles and sympathises with one struck by a calamity will have a reward equal to his."
Only Ali bin Asim narrated it, and it is one of the narrations for which he was criticised; it has also been narrated from others besides him. And Allah knows best.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7088