Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:6:131

That is because your Lord would not destroy the cities for wrongdoing while their people were unaware.  

That, sending of the messengers, is because (an, ˹phonetically˺ lightened, with the lām ˹of li-annahu˺ implied, thus ˹read as˺ li-annahu, ‘because’) your Lord would never destroy the towns through injustice, on their part, while their inhabitants were heedless, not having had any Messenger to make ˹things˺ clear to them.
القرآن:٦:١٣١

ذَٰلِكَ أَنْ لَمْ يَكُنْ رَبُّكَ مُهْلِكَ الْقُرَىٰ بِظُلْمٍ وَأَهْلُهَا غَافِلُونَ  

{ذلك} أي إرسال الرسل {أن} اللام مقدرة وهي مخففة أي لأنه {لم يكن ربَّك مهلك القرى بظلم} منها {وأهلها غافلون} لم يرسل إليهم رسول يبين لهم؟.

See similar narrations below:

Collected by Qurʾān
quran:11:117

And your Lord would not have destroyed the cities unjustly while their people were reformers.  

Yet your Lord would never destroy the towns through injustice, on His part, against them, while their inhabitants were righteous, that is, believers.
القرآن:١١:١١٧

وَمَا كَانَ رَبُّكَ لِيُهْلِكَ الْقُرَىٰ بِظُلْمٍ وَأَهْلُهَا مُصْلِحُونَ  

{وما كان ربك ليهلك القرى بظلم} منه لها {وأهلها مصلحون} مؤمنون.