Upon seeing a bad dream, one should make wudhu and engage in salaah
عن أبي هريرة رضي الله عنه عن النبي صلى الله عليه وسلم قال: والرؤيا ثلاثة: فرؤيا الصالحة بشرى من الله، ورؤيا تحزين من الشيطان، ورؤيا مما يحدث المرء نفسه، فإن رأى أحدكم ما يكره فليقم فليصل، ولا يحدث بها الناس (مسلم رقم 2263)
Hadhrat Abu Hurayrah (Radhiyallahu Anhu) reports that Rasulullah (Sallallahu Alaihi Wasallam) said: “There are three types of dreams. (The first type of dream is) a good dream which is a glad tiding from the side of Allah Ta’ala. (The second type of dream is) a dream from the side of Shaytaan wherein he tries to create worry in the heart of the one who sees the dream. (The third type of dream) is a dream which one sees what was playing in one’s mind. Thus if anyone of you sees a dream that he dislikes, then he should stand up and perform salaah, and he should not mention it to anyone.”