Sayyiduna Abu Hurairah (may Allah be pleased with him) narrated from the Messenger of Allah (peace and blessings be upon him), he (peace be upon him) said: "Allah has pardoned my Ummah for what arises in their hearts, as long as they do not act upon it or speak about it."
Related hadith on this topic