That hasn't happened to me for over 25 years but an incident traumatized me back then (I think!). :-D
I know that feeling. Back before I bought a proper stand and stopped leaning my bass against my amp, I once knocked my bass over at a gig and broke a string, without having any replacements or a backup bass.
I was able to rescue the situation only because I happened to have a heavy guitar string in my gig bag, and the break was above the nut, so I have able to tie a knot in the two strings, reattach it, tune, and play. It actually held so well, I played like that for months before bothering to replace the whole set.
That's the only time I've broken a string, though, and it was at least 16 years ago, because I only owned one bass before 2002.

