I need to implement my own red-black tree and I am stuck with deletion. I have found this book (Introduction to Algorithms) (p.222) and in the following code I can't understand this marked line.

Firstly, why do I need to do that if x.p is already pointed at y, because it is in particular y.right.p (== y).
Secondly, what if x is NIL and has no any fields then?
Please, can you explain me this?