Being attacked should be avoided during NPC conversations.
This happened very early in the campaign.
Location: Last Refugee Outskirts
NPC: Guard Captain Bravon
I exited the conversation, killed the monsters and was able to restart the conversation with the NPC.