He was retrieving his weapon.
Never attempt to holster your weapon with your finger on the trigger, and this sort of thing won’t happen.
Maybe they should invent a thing called a ‘safety lock’, and put them on all guns.
I’ve ‘heard’ that you can remove the cartridges from the chamber or magazine, and that it will help keep the gun from accidentally firing.