to stop yourself from doing sth; to prevent you from doing sth
Definitions from the Oxford Advanced Learner's Dictionary, 9th edition