I once had a pitbull charge me. He quickly lost interest in continuing his charge once he realized I might fight back.
To a dog, body language is *everything*.
You psyched him out by NOT appearing helpless, afraid and panicky.
Good job.