Abdur Rahman bin Abi Bakrah narrated from his father that the Messenger of Allah (ﷺ) said: "A ruler or judge should not decide between two people while he is angry."
Hadith Referenceمسند الإمام الشافعي / كتاب القضاء والأحكام والدعاوى والبينات واليمين ومع الشاهد والأيمان والشهادات / 1681