Anytime an officer is suspicious someone is carrying drugs or other illegal contraband, the person can be searched for "weapons." The officer has nothing to lose, now that the Supreme Court has spoken: If the search produces no weapons, there's no legal foul ball. But if it produces drugs, the cop is rewarded with a felony bust.

You can read the Supreme Court's reasoning in its opinion here.