The Messenger of Allah ﷺ said, "Whoever takes an oath and says, 'If Allah wills,' has not broken his oath."
حدثنا يحيى بن موسى حدثنا عبد الرزاق أخبرنا معمر عن ابن طاوس عن أبيه
أن رسول الله ﷺ قال من حلف فقال إن شاء الله لم يحنث
[Its chain is sahih]. Ibn Majah also recorded it in the Book of Expiations, chapter on making an exception in an oath, hadith no. 2104, and Nasai, hadith no. 3886, both from the hadith of Abdul-Razzaq with the same wording. Ibn Hibban also graded it sahih, hadith no. 1185, and it has corroborating narrations. The hadith of Mamar from Ibn Tawus was narrated by Bukhari, hadith no. 5242, and Muslim, hadith no. 24/1654.