Sure Hud

11:117

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

Und dein Herr hätte die Städte nimmer zu Unrecht vernichtet, während ihre Bewohner Heilstifter waren.

Tafsir 11:117

Your Lord, O Messenger, would not destroy any town if its inhabitants were acting correctly on earth. He would only destroy it if the inhabitants were causing corruption by disbelief, disobedience and sins.