At first glance, this passage seems to indicate that evil events will not happen to just people. From my own personal testimony, I can give countless examples of how people did evil to me or evil events came into my life. As I quickly surveyed just people in general, I spanned evil happening to just people from the Apostles martyrdoms to present day when people have lost loved ones due to sin, crime and injustice. How can this verse be true?
Many times in Scripture and in particular passages in Proverbs, the complete truth can be determined by reading the text in context or as in the middle chapters of Proverbs, read the latter portion of the verse.
There shall no evil happen to the just: but the wicked shall be filled with mischief. (Proverbs 12:21)
The passage is providing for us the promise that as just people live their lives and make decisions, they will not fall into evil or as the latter part of the verse says, mischief. Those who walk with the Lord, will be guided by the same as they live their lives. They will not be allowed to stumble and stagger in darkness, but will have the light of his presence and scripture to light their path and to guide their footsteps.
So if I want to be free from falling into evil, I must walk with the Lord, allow him to inspect my life and removed that which is not just, seek his face as decisions must be made and rejoice in the promise of his goodness and protection.