Prophet Hud - 11:117 Your Lord will not destroy the cities as long as their people are righteous.
How were the previous guilty generations destroyed?
The Spider/29:40 And We seized them all with their sins. And We sent upon some of them a mad storm, and a terrible sound seized some of them, and We drove some of them into the earth and drowned some of them. It was not Allah who wronged them; they wronged themselves.

Prophet Joseph/12:110 When the messengers gave up hope and thought that they had been deceived, then Our victory came to them. Indeed, whom We will, We will save. Our torment cannot be turned back from the guilty people.

The Pilgrimage/22:44 And the inhabitants of Median. Even Moses was denied. I gave the disbelievers a respite and then I called them to account; how is it that they do not recognize Me!
The Pilgrimage/22:45 We destroyed the inhabitants of many cities because of the injustice they committed, and what remained of them were collapsed roofs, abandoned wells and deserted palaces...