Most encounters in life depends on one's life journey, and what one comes to learn. The best protection is to keep one's thought pure, and practice ''do unto others as you will like them to do unto you.''
So when you eventually fall in with a bad person, you would have learnt the lesson and be wiser for it.