Language:
كتاب العلم
3  
Knowledge
(2)
Chapter: Whoever is asked about knowledge while he is busy in some conversation, so he finished talking and then answered the questioner
(2)
باب مَنْ سُئِلَ عِلْمًا وَهُوَ مُشْتَغِلٌ فِي حَدِيثِهِ فَأَتَمَّ الْحَدِيثَ ثُمَّ أَجَابَ السَّائِلَ
Sahih al-Bukhari 59

Narrated Abu Huraira:

While the Prophet (ﷺ) was saying something in a gathering, a Bedouin came and asked him, "When would the Hour (Doomsday) take place?" Allah's Messenger (ﷺ) continued his talk, so some people said that Allah's Messenger (ﷺ) had heard the question, but did not like what that Bedouin had asked. Some of them said that Allah's Messenger (ﷺ) had not heard it. When the Prophet (ﷺ) finished his speech, he said, "Where is the questioner, who inquired about the Hour (Doomsday)?" The Bedouin said, "I am here, O Allah's Apostle ." Then the Prophet (ﷺ) said, "When honesty is lost, then wait for the Hour (Doomsday)." The Bedouin said, "How will that be lost?" The Prophet (ﷺ) said, "When the power or authority comes in the hands of unfit persons, then wait for the Hour (Doomsday.)"

حَدَّثَنَا مُحَمَّدُ بْنُ سِنَانٍ، قَالَ حَدَّثَنَا فُلَيْحٌ، ح وَحَدَّثَنِي إِبْرَاهِيمُ بْنُ الْمُنْذِرِ، قَالَ حَدَّثَنَا مُحَمَّدُ بْنُ فُلَيْحٍ، قَالَ حَدَّثَنِي أَبِي قَالَ، حَدَّثَنِي هِلاَلُ بْنُ عَلِيٍّ، عَنْ عَطَاءِ بْنِ يَسَارٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ بَيْنَمَا النَّبِيُّ صلى الله عليه وسلم فِي مَجْلِسٍ يُحَدِّثُ الْقَوْمَ جَاءَهُ أَعْرَابِيٌّ فَقَالَ مَتَى السَّاعَةُ فَمَضَى رَسُولُ اللَّهِ صلى الله عليه وسلم يُحَدِّثُ، فَقَالَ بَعْضُ الْقَوْمِ سَمِعَ مَا قَالَ، فَكَرِهَ مَا قَالَ، وَقَالَ بَعْضُهُمْ بَلْ لَمْ يَسْمَعْ، حَتَّى إِذَا قَضَى حَدِيثَهُ قَالَ ‏"‏ أَيْنَ ـ أُرَاهُ ـ السَّائِلُ عَنِ السَّاعَةِ ‏"‏‏.‏ قَالَ هَا أَنَا يَا رَسُولَ اللَّهِ‏.‏ قَالَ ‏"‏ فَإِذَا ضُيِّعَتِ الأَمَانَةُ فَانْتَظِرِ السَّاعَةَ ‏"‏‏.‏ قَالَ كَيْفَ إِضَاعَتُهَا قَالَ ‏"‏ إِذَا وُسِّدَ الأَمْرُ إِلَى غَيْرِ أَهْلِهِ فَانْتَظِرِ السَّاعَةَ ‏"‏‏.‏
Reference : Sahih al-Bukhari 59
In-book reference : Book 3, Hadith 1
USC-MSA web (English) reference : Vol. 1, Book 3, Hadith 56
  (deprecated numbering scheme)