I do think it is good that you know doing bad things won't turn out well. It's important to recognize when things are unhealthy.
not to shamelessly promote my own thread, but I asked people on here to list their distractions and coping mechanisms:
Let's support each other by sharing distractions that people can use
Maybe you can use one of those distraction techniques to keep yourself safe?