If you have fallen into the same trap I have, where you feel like you need junk food in stressful times, then you should find alternate means of stress relief. You should find ways to regularly cope with stress in the moment, as well as trying to regularly and pre-emptively reduce your stress.
There are a number of in-the-moment coping mechanisms. These can include deep breathing exercises, finding a substitute consumable (sparkling water instead of soda, stick of gum instead of a cookie, maybe even a protein bar instead of a candy bar), writing out your feelings, listening to relaxing music, and going for a quick walk. Experiment with a few and find out if these help you when you are feeling overwhelmed.
Many in-the-moment coping mechanisms can also serve as regular stress relievers whenever you may use them. Regular exercise, writing in a journal and meditation are all great forms of stress relief and can enhance your day to day stress level. If you speak with a therapist or a trusted loved one you may also find yourself feeling better.
In any case, try to understand why you are feeling bad, stressed, or emotional; work on that problem. Don't exacerbate it by binging on ice cream.