Excellent advice from Mr. Ettin.
I would say never introduce a weapon of any kind into a 'situation" unless it is absolitely necessary for your safety.
Bearing in mind that officers of the law are armed and are quite properly concerned about their own safety, leave the gun in the vehicle when you get out to talk to the officer.
It may also be a good practice to re-think your route planning to avoid undesirable areas of the city whenever possible.
The soldier's pack is not so heavy a burden as the prisoner's chains. Dwight Eisenhower