An-Nur 24:29
لَّيْسَ عَلَيْكُمْ جُنَاحٌ أَن تَدْخُلُوا۟ بُيُوتًا غَيْرَ مَسْكُونَةٍ فِيهَا مَتَـٰعٌ لَّكُمْ ۚ وَٱللَّهُ يَعْلَمُ مَا تُبْدُونَ وَمَا تَكْتُمُونَ
Laysa AAalaykum junahun an tadkhuloobuyootan ghayra maskoonatin feeha mataAAun lakum wallahuyaAAlamu ma tubdoona wama taktumoon
There is no blame upon you for entering houses not inhabited in which there is convenience for you. And Allāh knows what you reveal and what you conceal.
There is no sin on you if you enter uninhabited houses in which you have rightful benefit. Allah knows what you reveal and what you conceal.