Poor guy.
I have my cat Penny that is just like that.
One minute she's purring and wanting to be patted,
and that's at anyone's own risk also.
I hold her with 2 hands and then pat her so
she doesn't turn on me.LOL