I'm wondering if this is my self destructive behavior thinking this.

Is it bad to continue hanging out with a friend who helps take away the things that keep you up at night? In my mind, I'm giving myself a hard time about it because they can always leave and then I'll be back to having no one PLUS losing someone I care about and enjoy. 

I feel like I have this terrible trait that I'd like to say is self defense or fear (whatever it is it's not good and it's toxic to myself) where I feel it's safe to keep people at a distance. Because I always end up getting hurt. No one likes getting hurt and I feel it's a valid thought but I also feel it's not something I should act on.

There's more than one reason why I'm thinking about this and it comes back to me being scared of being alone/hurt in the end.

If im depressed and I have someone who helps me feel some happiness, shouldn't I just let it be and enjoy it? I don't have to ruin it out of toxic defense because then I'll never be able to get where I want to be.

I have friends that I care about dearly. Most of them though if they decided to not talk to me, I would think i would be OK. But this person I don't know. I feel like I've became close with them lately. And that's when I start to become destructive because then I feel like I gave them a knife.

Am I the only one who does this? How do you handle this?