"I used to see a dream that would make me ill."He said, I then met Abu Qatada, who said, "I too used to see a dream that would make me ill, until I heard the Messenger of Allah ﷺ say, 'A good dream is from Allah. So if any of you sees what he likes, let him relate it only to those he loves. And if he sees what he dislikes, let him spit to his left three times, seek refuge in Allah from the evil of Satan and from its evil, and not relate it to anyone. Then it will not harm him.'"
إن كنت لأرى الرؤيا تمرضني، قال: فلقيت أبا قتادة، فقال: وأنا كنت لأرى الرؤيا فتمرضني حتى سمعت رسول الله ﷺ يقول: الرؤيا الصالحة من الله، فإذا رأى أحدكم ما يحب، فلا يحدث بها إلا من يحب، وإن رأى ما يكره، فليتفل عن يساره ثلاثا، وليتعوذ بالله من شر الشيطان وشرها، ولا يحدث بها أحدا، فإنها لن تضره.
Bukhari narrated it in the Book of Interpretation of Dreams (7044), and Muslim in the Book of Dreams (4:2261), both through the route of Shuba, from Abd Rabbih bin Saeed, from Abu Salama, who related it.