The Messenger of Allah ﷺ said, "True dreams are from Allah, and bad dreams are from Satan. So if any of you sees something he dislikes, let him spit lightly to his left three times and seek refuge with Allah from its evil, and it will not harm him."
حدثنا قتيبة حدثنا الليث عن يحيى بن سعيد عن أبي سلمة بن عبد الرحمن
عن رسول الله ﷺ أنه قال الرؤيا من الله والحلم من الشيطان فإذا رأى أحدكم شيئا يكرهه فلينفث عن يساره ثلاث مرات وليستعذ بالله من شرها فإنها لا تضره
322 5747 Sourced from, agreed upon. Muslim reported it in "Dreams," hadith 2261, from Qutayba, and Bukhari, hadith 47, from the hadith of Yahya bin Saeed Ansari, through him. On this topic there are also narrations from Abdullah bin Amr [Ahmad 2/1219], Abu Saeed [to come, 3453], Jabir [Muslim 2262], and Anas [Tabarani in al-Awsat, 4/126, hadith 3204].