A loophole will be closed to ensure perpetrators can't get away with breaking into their victims' homes after an offender won a controversial High Court case.