Defending oneself with a gun against an attacking dog is a serious issue. Using a gun to stop an attack could be not only reasonable but necessary in some circumstances. For details, see Self Defense When a Dog Attacks a Person.
Using a Gun In Self-Defense Against a Dog