Ja'far bin Muhammad narrates from his father, from his grandfather, who said: When the Messenger of Allah (peace be upon him) passed away and people came to offer condolences, he heard a man saying: "There are those who offer condolences in every calamity from Allah, and there are successors for everyone who perishes, and there are inheritors for everyone who passes away. Place your trust in Allah, and have hope only in Him. Truly, the real afflicted one is the one who is deprived of reward."
Hadith Referenceمسند الإمام الشافعي / كتاب الجنائز / 603
Hadith Takhrijاسناده ضعيف جدا، فان القاسم بن عبدالله بن عمر متروك : اخرجه البيهقي : 4/ 60 ۔ وفي المعرفة السنن والآثار له (2188)۔