Salama reported,

We set out with the Prophet ﷺ to Khaybar. One of the men said, "Amir, let us hear some of your verses." So he began chanting to drive the camels along.The Prophet ﷺ asked, "Who is the driver?"They replied, "Amir."He said, "May Allah have mercy on him."They said, "Messenger of Allah, if only you had let us benefit from him longer."He was killed the next morning. The people said, "His deeds have been nullified. He killed himself."When I returned, they were saying that Amir's deeds had been nullified. So I came to the Prophet ﷺ and said, "Prophet of Allah, may my father and mother be your ransom, they claim that Amir's deeds have been nullified."He replied, "Whoever said that has lied. He has two rewards. He was a striver and a fighter. What death could be greater than his?"

Bukhari 6891

Sahih

حدثنا المكي بن إبراهيم حدثنا يزيد بن أبي عبيد

عن سلمة قال

خرجنا مع النبي ﷺ إلى خيبر فقال رجل منهم أسمعنا يا عامر من هنيهاتك فحدا بهم فقال النبي ﷺ من السائق قالوا عامر فقال رحمه الله فقالوا يا رسول الله هلا أمتعتنا به فأصيب صبيحة ليلته فقال القوم حبط عمله قتل نفسه فلما رجعت وهم يتحدثون أن عامرا حبط عمله فجئت إلى النبي ﷺ فقلت يا نبي الله فداك أبي وأمي زعموا أن عامرا حبط عمله فقال كذب من قالها إن له لأجرين اثنين إنه لجاهد مجاهد وأي قتل يزيده عليه

البخاري 6891صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Blood money
Chapter
If someone kills himself by mistake, there is no blood money for him
Numbering
Darussalam 6891
Bukhari 6891