If you’ve spent a lonely night at home eating chocolates and/or ice cream, you shouldn’t feel guilty. That’s because loneliness can cause an intense desire for sugary foods, a new study found.

Published in JAMA Network Open, researchers linked brain chemistry from those who socially isolate to poor mental health, weight gain, cognitive decline and chronic diseases like Type 2 diabetes and obesity.

“While it is established that obesity is linked to depression and anxiety, and that binge eating is understood to be a coping mechanism against loneliness, I wanted to observe the brain pathways associated with these feelings and behaviors,” said senior study author Arpana Gupta, PhD, an associate professor and director of the G. Oppenheimer Center for Neurobiology of Stress and Resilience at the University of California in Los Angeles.

The researchers explored how brain chemistry is altered and how it processes food cues based on social settings in 93 premenopausal participants. Their findings revealed those who experienced loneliness or isolation had a higher percentage of body fat and displayed more poor eating behaviors, such as food addiction and uncontrolled eating.

Scientists used MRI scans to monitor how the participants responded to abstract images of sweet and savory foods. The results showed those who experienced isolation had the most activity in certain regions of the brain that play a key role in responding to sugar cravings. Those same participants showed a lower reaction in regions that deal with self-control.

“Social isolation can cause food cravings similar to the cravings for social connections,” Gupta said. “We show evidence for the fact that our social bonds are key in regard to how we eat unhealthy foods — especially highly calorie-dense foods and sweets.”

If you have social anxiety and tend to self-isolate, there are ways to overcome it, according to Calm.

Identify your triggers

Journaling what you don’t like about an event — including the atmosphere, people and activities — can help you create a plan to tackle each issue. For example, if you don’t like busy rooms, explore why with a therapist or a trusted friend. Instead of jumping full force into an all night rave, start small with a dinner party.

According to Better Up, identifying your triggers will force you to “face your vulnerabilities, which can reduce stress.”

Focus on others

According to Calm, most social anxiety comes from the fear of being judged. When you’re out and about, try not to focus on yourself and instead focus on the people around you. If you’re feeling down about yourself, give someone a compliment and strike up a conversation. Or, if you have to, take a break and find an area to do breathing exercises.

Replace negative thoughts

For every self-criticism, give yourself at least three or more compliments until those negative thoughts disappear. Here are a few examples from the Mayo Clinic.

  • Instead of this: “It’s too complicated.” Try this: “I’ll tackle it from a different angle.”
  • Instead of this: “I don’t have the resources.” Try this: “Necessity is the mother of invention.”
  • Instead of this: “I’m too lazy to get this done. Try this: “I couldn’t fit it into my schedule, but I can re-examine some priorities.”

If you’re experiencing social anxiety or self-isolation, it’s important to seek help and a trusted community to help you overcome the fear. Unchecked overthinking and pessimistic self-talk can lead to anxiety disorders or depression.