Exodus 22:2

New International Version Bible (NIV)
“If a thief is caught breaking in at night and is struck a fatal blow, the defender is not guilty of bloodshed;

Read Exodus 22:2 in other translations