First, you have to believe it was charging. Let’s assume.
Then you have to wonder if the cop did something stupid like enter the perimeter with an obvious known dog threat.
How about not killing the dog? Start there. The situation was not human life threatening. Wait for the owner to gather the dog before entering the gate. Not that fkng hard.
Oops, you're assuming...........naughty, naughty!