Happens to me all too often. I note the frame number. Put the camera into a changing bag and remove both the roll and takeup spool and wind the film back onto the roll so I can see what I have loaded. Then I reload the camera and try to use it before I forget again.

If you don't have a changing bag, a winter coat will work. Just make sure that you zip it up and fold it so all openings are covered. Then slide your arms into the sleeves. Do this in a darkened room – don't turn on the lights.

You can see that this has happened enough times that I have a procedure in place.