Messenger of Allah ﷺ 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. "
قَالَ رَسُولُ اللَّهِ ﷺ إِذَا أَنْزَلَ اللَّهُ بِقَوْمٍ عَذَابًا أَصَابَ الْعَذَابُ مَنْ كَانَ فِيهِمْ ثُمَّ بُعِثُوا عَلَى أَعْمَالِهِمْ