He pledged allegiance to the Messenger of Allah ﷺ beneath the tree, and reported that the Messenger of Allah ﷺ said, "Whoever falsely swears by a religion other than Islam is as he said. Whoever kills himself with something will be tormented with it on the Day of Resurrection. And no person is bound by a vow concerning what he does not own."
حدثنا أبو توبة الربيع بن نافع حدثنا معاوية بن سلام عن يحيى بن أبي كثير قال أخبرني أبو قلابة أن
أنه بايع رسول الله ﷺ تحت الشجرة أن رسول الله ﷺ قال من حلف بملة غير ملة الإسلام كاذبا فهو كما قال ومن قتل نفسه بشيء عذب به يوم القيامة وليس على رجل نذر فيما لا يملكه
Bukhari narrated it in the Book of Military Expeditions, chapter on the Battle of Hudaybiya, etc., no. 4171, and Muslim narrated it in the Book of Faith, chapter on explaining the error of one who deems it lawful to kill himself, etc., no. 110, from the hadith of Muawiya bin Salam, through the same chain.