REad the whole thing. Ravi had a key. He could walk in at any moment. Every single little bit of the law you are citing is inapplicable in that case.
I'll bet that comes as a shock to Ravi, seeing that he was convicted of it. /s