Tamim bin Tarafa reported,

A beggar came to Adi bin Hatim asking him for help to buy a servant, or to contribute toward the price of one. Adi said, "I have nothing to give you except my coat of mail and my helmet. I will write to my family instructing them to hand it over to you."The man was not satisfied with this. Adi became angry and said, "By Allah, I will give you nothing at all."Then the man relented and accepted the offer. Adi said, "By Allah, were it not that I heard the Messenger of Allah ﷺ say, 'Whoever swears an oath, then sees something more pious than it, let him pursue what is more pious,' I would not have broken my oath."

Azami 7107

Sahih

عن تميم بن طرفة قال

جاء سائل إلى عدي بن حاتم، فسأله نفقة في ثمن خادم أو في بعض ثمن خادم، فقال: ليس عندي ما أعطيك إلا درعي ومغفري، فأكتب إلى أهلي أن يعطوكها، قال: فلم يرض، فغضب عدي، فقال: أما والله لا أعطيك شيئا، ثم إن الرجل رضي، فقال: أما والله لولا أني سمعت رسول الله ﷺ يقول: من حلف على يمين ثم رأى أتقى الله منها، فليأت التقوى ما حنثت يميني.

الأعظمي 7107صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Oaths and vows
Chapter
Faith
Section
Breaking an oath before expiation
Numbering
Jami al-Kamil 7107 (2nd edition)
Azami 7107