Sahih al-Bukhari, Book 60, Hadith 55 (Bukhari 3242)

Narrated Ibn `Umar:

Allah's Messenger (ﷺ) said, "Do not enter the ruined dwellings of those who were unjust to themselves unless (you enter) weeping, lest you should suffer the same punishment as was inflicted upon them."