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: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.
القرآن:١١:١١٧

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

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

See similar narrations below:

Collected by Qurʾān, Ṭabarānī
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.
القرآن:٦:١٣١

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

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

بَابٌ

tabarani:2281Abū Ḥanīfah Muḥammad b. Ḥanīfah al-Wāsiṭī > Abū al-Ashʿath Aḥmad b. al-Miqdām > ʿUbayd b. al-Qāsim > Ismāʿīl b. Abū Khālid > Qays > Jarīr

[Machine] When {And your Lord would not have destroyed the cities unjustly while their people were reformers} was revealed, he said, "And their people help each other."  

الطبراني:٢٢٨١حَدَّثَنَا أَبُو حَنِيفَةَ مُحَمَّدُ بْنُ حَنِيفَةَ الْوَاسِطِيُّ ثنا أَبُو الْأَشْعَثِ أَحْمَدُ بْنُ الْمِقْدَامِ ثنا عُبَيْدُ بْنُ الْقَاسِمِ ثنا إِسْمَاعِيلُ بْنُ أَبِي خَالِدٍ عَنْ قَيْسٍ عَنْ جَرِيرٍ قَالَ

لَمَّا نَزَلَتْ {وَمَا كَانَ رَبُّكَ لِيُهْلِكَ الْقُرَى بِظُلْمٍ وَأَهْلُهَا مُصْلِحُونَ} قَالَ «وَأَهْلُهَا يُنْصِفُ بَعْضُهُمْ بَعْضًا»