I've been to Barcelona alone several times and at the same age as you are now. Barcelona is safe, just do be aware of pickpockets but I never had an issue. There are great Gaudi architecture to visit, amazing food and there is no issue with eating alone. The water front is nice and there is easy public transit. Why lose the money due to a loser ex? Go and enjoy!