How do you avoid this kind of nightmare scenario?
The Dallas Police Chiefs only answer was to hire people with common sense and good people skills.
No. The answer is to restore equality of rights between police officers and ordinary people. As long as one group of people has rights another group doesnt, theres no way to ensure reliable safeguards against the first groups abusive treatment of the second.