Sunan an-Nasa'i, Book 49, Hadith 3 (Nasa'i 5390)

It was narrated that Abu Hurairah said:

"The Messenger of Allah said: 'If a judge passes judgment and strives to reach the right conclusion and gets it right, he will have two rewards; if he strives to reach the right conclusion but gets it wrong, he will still have one reward."