Sahih al-Bukhari #7108
Afflictions and the End of the World 92:55
Narrated Ibn `Umar:
Allah's Messenger (ﷺ) said, "If Allah sends punishment upon a nation then it befalls upon the whole population indiscriminately and then they will be resurrected (and judged) according to their deeds. "