Did You Curse Me With Your Heart Or With Your Tongue?

Ammar (may Allah be pleased with him), cursed Prophet Muhammad (SAW) when under torture from the Quraysh. It made him depressed. Prophet Muhammad (SAW) asked him did you curse me with your heart or with your tongue?
https://aboutislam.net/reading-islam/understanding-islam/purity-of-intentions/