Sunan Abi Dawud, Hadith 2191

The above tradition has also been transmitted by ‘Amr bin Shu’aib through a different chain of narrators to the same effect. This version adds “If anyone swears an oath to do an act of disobedience to GOD, his oath is not valid, and if anyone swears an oath to sever relationship, his oath is not valid(i.e., he must not fulfill it)

حَدَّثَنَا مُحَمَّدُ بْنُ الْعَلاَءِ، أَخْبَرَنَا أَبُو أُسَامَةَ، عَنِ الْوَلِيدِ بْنِ كَثِيرٍ، حَدَّثَنِي عَبْدُ الرَّحْمَنِ بْنُ الْحَارِثِ، عَنْ عَمْرِو بْنِ شُعَيْبٍ، بِإِسْنَادِهِ وَمَعْنَاهُ زَادَ ‏ "‏ مَنْ حَلَفَ عَلَى مَعْصِيَةٍ فَلاَ يَمِينَ لَهُ وَمَنْ حَلَفَ عَلَى قَطِيعَةِ رَحِمٍ فَلاَ يَمِينَ لَهُ ‏" ‏ ‏.‏

sunnah.com

also referenced under: Hadith 2186 (Hasan)