In The Name of Allaah, The Most Merciful, The Bestower of Mercy
Imaam Ibnul Qayyim [rahimahullaah] said: Hearts that are emptied of Love for Allaah -hearts that are turned away from Him and seeking remedy from others besides Him- are afflicted with an infatuation with images; for when the heart is filled with Love of Allaah and a strong love for meeting Him [i.e. in the hereafter], this infatuation with images is repelled from it. And for this reason, Allaah [The Most High] stated about Yusuf [alayhis-salaam]:
[كَذَٰلِكَ لِنَصْرِفَ عَنْهُ السُّوءَ وَالْفَحْشَاءَ ۚ إِنَّهُ مِنْ عِبَادِنَا الْمُخْلَصِينَ -Thus it was, that We might turn away from him evil and illegal sexual intercourse. Surely, he was one of Our chosen, guided slaves]. This shows that sincerity to [Allaah] is a means to repelling [evil]. And because of this, some of the Salaf said: ‘’Infatuation is an agitation in empty hearts.” Meaning: [Hearts] emptied of other than what they crave for.
[Source: An excerpt from At-Tibbun Nabawiy’ by Imaam Ibnul Qayyim (rahimahullaah) with the footnotes and checking of Al-Allaamah Muhammad Haamid Al-Faqee (rahimahullaah) page180. slightly paraphrased]