If they break in from unlawful entry then yes. They would not get shot for a misunderstanding though.
You don't know about it. You are lying there half awake in front of the TV catching the last of the game in LA ~ wearing your holster ~ ready to go.
The cop knocks at the door ~ the door swings in ~ somebody forgot to close it all the way.
You lurch around and pull your piece ~