The Prophet (SAWA) said with regards to a man who prays in spite of committing sins, ‘Verily his prayer will prevent him [from them] some day or other, and then he will soon repent.
رسولِ اللّهِ (صَلَّيَ اللهُ عَلَيهِ وَ آلِهِ) ـ في رجُلٍ يُصَلِّي مَعهُ ويَرتَكِبُ الفَواحِشَ ـ: إنّ صلاتَهُ تَنهاهُ يَوماً ما، فلَم يَلبَث أن تابَ.