In Paul Roberts' book, How to Say Nothing, he offers some useful tips on how to avoid saying things that you may later regret. It can be difficult in today's world to know when to keep your thoughts to yourself, but Roberts provides some helpful guidelines.
First, Roberts suggests that you consider the consequences of speaking up before you say anything. If you're not sure whether or not what you're about to say is appropriate, it's probably best to err on the side of caution and remain silent.
Second, think about whether or not what you're about to say is really necessary. If it's not going to add anything constructive to the conversation, chances are it's better left unsaid.
Finally, be aware of the tone in which you speak. Even if what you're saying is perfectly innocent, it can come across as harsh or judgmental if said in the wrong way. If you're unsure how your words will be received, it's again best to stay quiet.
With a little practice, following these tips can help you become more adept at knowing when it's better to say nothing at all.