So the way I see it is. If your dog is trained in protection and the attacker doesn't have a weapon, knife, gun, bat, etc... and there aren't multiple attackers. Then your dog may be able to protect you.
However, if the dog did go after the attacker and the attacker had a weapon he may very well just kill the dog and continue the attack.
I would bet a small amount of money that the dog would bark and at least alert you of something that maybe you cannot hear or see yet. The bark may stop the attacker or as stated above he may just come through the dog and continue his attack on you. So why not get a firearm and take the proper training to become proficient and this way even with multiple attackers or an attacker with a weapon you have the ability to protect yourself and the dog.