Language:
كتاب الفتن
92  
Afflictions and the End of the World
(2)
Chapter: “After me you will see things which you will disapprove of.”
(2)
باب قَوْلِ النَّبِيِّ صلى الله عليه وسلم ‏"‏ سَتَرَوْنَ بَعْدِي أُمُورًا تُنْكِرُونَهَا ‏"‏
Sahih al-Bukhari 7054

Narrated Ibn `Abbas:

The Prophet (ﷺ) said, "Whoever notices something which he dislikes done by his ruler, then he should be patient, for whoever becomes separate from the company of the Muslims even for a span and then dies, he will die as those who died in the Pre-lslamic period of Ignorance (as rebellious sinners). (Fath-ul-Bari page 112, Vol. 16)

حَدَّثَنَا أَبُو النُّعْمَانِ، حَدَّثَنَا حَمَّادُ بْنُ زَيْدٍ، عَنِ الْجَعْدِ أَبِي عُثْمَانَ، حَدَّثَنِي أَبُو رَجَاءٍ الْعُطَارِدِيُّ، قَالَ سَمِعْتُ ابْنَ عَبَّاسٍ ـ رضى الله عنهما ـ عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ ‏ "‏ مَنْ رَأَى مِنْ أَمِيرِهِ شَيْئًا يَكْرَهُهُ فَلْيَصْبِرْ عَلَيْهِ، فَإِنَّهُ مَنْ فَارَقَ الْجَمَاعَةَ شِبْرًا فَمَاتَ، إِلاَّ مَاتَ مِيتَةً جَاهِلِيَّةً ‏"‏‏.‏
Reference : Sahih al-Bukhari 7054
In-book reference : Book 92, Hadith 7
USC-MSA web (English) reference : Vol. 9, Book 88, Hadith 177
  (deprecated numbering scheme)