When flu season rolls around and a coworker starts sneezing, you know what to do: Wash your hands, load up on vitamin C, and avoid all physical contact.

But if that same coworker were to constantly complain rather than sneeze, how would you react? Would you protect yourself as you would a cold, or start complaining right along with them?

Without a prevention plan, you might find yourself catching their stress.

“Emotions are definitely contagious,” clinical psychologist Jenny Taitz, Psy.D., tells Shine. “When you see someone's upset, you have mirror neurons that fire, related to empathy.”

Think of it like watching a sad movie: You might not be losing Jack, the love of your life, as the Titanic sinks, but you still sob along and feel Rose's pain.

'Emotions are definitely contagious. When you see someone's upset, you have mirror neurons that fire, related to empathy.'
- Jenny Taitz, Psy.D.

“Catching” a pal’s emotions isn’t always bad: Sharing emotions can help you better understand what someone’s going through and help a friend feel validated in whatever they’re feeling.

But absorbing the frustrations of your coworkers, family members, and even fellow commuters? That can take a toll.

Research backs this up. One study found that roommates of mildly depressed college students reported increasing levels of depression over a three-month timeframe. The takeaway: The moods of those around you can seriously impact your own.

The moods of those around you can seriously impact your own.

Here, how to protect yourself from catching unwanted feels.

1. Recognize What’s Going On

If you feel yourself starting to bristle as your cubicle mate sighs, or hear negative thoughts start to loop in your own mind, take note. “Being able to observe and describe people's negative emotions, and your own, is one way to get out of them,” Taitz says.

'Being able to observe and describe people's negative emotions, and your own, is one way to get out of them.'
- Jenny Taitz, Psy.D.

Once you’ve recognized that you’re in a funk, think about why. Is it a sign you need to make a change in your life? Or just an indicator that you need a boost of positive energy? Respond accordingly.

2. Don’t Take It Personally

If a friend or boss is upset, it might trigger some worry for you—is it your fault? Did you say the wrong thing?

Recognize that a boss’s bad mood isn’t always an indictment of your work, or a sign that you should be upset, too. There could be a million other causes.

If you’re still panicking about what you might’ve done to cause the downturn, Taitz says, change the mental conversation: “(Remind yourself), 'Joe is always like this' or 'Joe is going through a hard time.'”

3. Try to Flip the Script

If the contagious person is a close friend or loved one, try helping them move through the mood.

“People don’t always feel better when they talk about whatever is bothering them,” Taitz says. “If a good friend is going through a hard time, you can say, ‘I know this is a hard time. Rather than continuing to talk about what’s upsetting, would you want to take a night off?'”

Then, offer up another subject to discuss or an activity to take their mind off the negative.

Talking through a problem over and over again—aka “co-ruminating”—can end up dragging both parties down.

4. Bring on the Self-Care

When you find those prickly emotions coming on, “actively do something to self-soothe,” Taitz suggests. “Maybe you have a ginger candy you like to eat with total mindfulness, or a positive or calming playlist you can play if you’re in an office space and if everyone’s stressed.”

Whatever it is that calms you down—whether it's a breathing exercise or even the "Release Frustrations" meditation in the Shine app—think of it like a first-aid kit: Have it handy for the first sign of negativity creeping in.

5. If You’re the One Infecting Others, Acknowledge It

What if you’re the one dragging everyone down?

First, remind yourself that everyone catches feels and that’s what friends, co-workers, and family are for.

Think of the last time you helped someone through a tough time—chances are, you felt needed and important and may have even learned a thing or two.

Then, “check in with yourself,” Taitz says. “Ask, what would help you more? People commiserating, or you getting a dose of freedom? And maybe it’s both.”

If you want someone to validate your bummer mood, try talking to someone and break down what got you to a certain mood in the first place. “There’s something nice about getting social support,” Taitz says—as long as it’s coming from willing participants.

If you want to shake off the negativity, let your friends and loved ones know. Taitz's suggestion: “You can say, ‘Look, I had a bad day, and I don’t want you to think it’s about you. I’m really happy we’re doing this and I’m going to try my best to be in the moment.’”

Then, actually do it—focus on whatever you’re doing, saying or even eating, and see if you can shift your mood. Positive emotions—like happiness and joy—are contagious, too. Try actively catching those.

Read next: How to Avoid Empathy Burnout