One can, just by chance, be already at a location when violence breaks out without being part of the violence. IMO, it is best to let the police deal with the rioters unless you are protecting or helping a person who is being attacked. If they’re smashing windows, you should just try to get away, not “take the rioters down.” The “kettling” mentioned prevents innocent people from getting away from the violence.
Here is one researcher’s account of being kettled. https://www.theguardian.com/commentisfree/2010/dec/10/kettled-shocking-experience