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/hadî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-Khatîb Al-Baghdâdî, Al-Rihlah fî Talab Al-Hadîth article 22; Al-Dhahabî, Siyar A’lâm Al-Nubalâ` 4:209.