What if I hugged him at the spur of the moment?
That depends. How did you feel when you hugged him?
Not so good, since he's a guy.
I get it that you were excited and you hugged him. I guess he was ok with it so it's alright.
It is alright. I hugged him hard cause I know he wouldn't reject me.
Next time, try to ask for permission but it is understandable that when you get excited you don't think about it. If they are bothered I am sure they will tell you or stop you.