Al-Hajj 11

وَمِنَ ٱلنَّاسِ مَن يَعْبُدُ ٱللَّهَ عَلَىٰ حَرْفٍ فَإِنْ أَصَابَهُۥ خَيْرٌ ٱطْمَأَنَّ بِهِۦ وَإِنْ أَصَابَتْهُ فِتْنَةٌ ٱنقَلَبَ عَلَىٰ وَجْهِهِۦ خَسِرَ ٱلدُّنْيَا وَٱلْءَاخِرَةَ ذَٰلِكَ هُوَ ٱلْخُسْرَانُ ٱلْمُبِينُ ﴿١١﴾

Wamina alnnasi man yaAAbudu Allaha AAala harfin fain asabahu khayrun itmaanna bihi wain asabathu fitnatun inqalaba AAala wajhihi khasira alddunya waalakhirata thalika huwa alkhusranu almubeenu

And among mankind is he who worships Allah as it were, upon the very edge (i.e. in doubt); if good befalls him, he is content therewith; but if a trial befalls him, he turns back on his face (i.e. reverts back to disbelief after embracing Islam). He loses both this world and the Hereafter. That is the evident loss. The Noble Quran