He attributed it to the Prophet ﷺ, who said, "Whoever swears an oath and says, 'If Allah wills,' has made an exception."
حدثنا أحمد بن حنبل حدثنا سفيان عن أيوب عن نافع
يبلغ به النبي ﷺ قال من حلف على يمين فقال إن شاء الله فقد استثنى
[Sahih] Reported by Nasai, The Book of Oaths and Vows, Chapter on Making an Exception, no. 3860, from the hadith of Sufyan bin Uyayna through this same chain. It is also found in Musnad Ahmad, 2/10. See also the hadith that follows.