It is reported that Abū Al-‘Āliyah – Allāh have mercy on him – said:
I would travel for days to a man to hear [knowledge/ḥadīth ] from him, and the first thing I would check about him is his prayer: if he performed it properly I would stay and hear [knowledge] from him, but if he neglected it, I would return without hearing from him, and I would say, ‘He will be even more neglectful of other matters.’
Al-Khaṭīb Al-Baghdādī, Al-Riḥlah fī Ṭalab Al-Ḥadīth article 22; Al-Dhahabī, Siyar A’lām Al-Nubalā` 4:209.