The glass used in sex toys is insanely strong. It's nigh-impossible to break it with your hands alone, so the chances of it breaking inside you are even slimmer.
Often, the only way to break one is to A: drop it on a hard surface (and usually a glass toy will survive this) or B: have it go from freezing cold to boiling hot or vice versa very quickly (and again, it may survive this). Additionally, in the event that one does break, the kind of glass used will break into big chunks, rather than a million little splinters.
There are some things you can (and should) do to keep a glass toy in tip-top condition. Avoid wild temperature changes (it's safe to boil a glass toy to clean it, mind). Keep it wrapped in cloth to prevent scratches - padded bags are best because they also protect from impact damage. Try not to drop a glass toy anywhere hard, and always carefully inspect it for scratches and fractures before you play - if you see any, don't use it.