In BFS, we take a vertex from the queue, processes all its neighbours and put them in the queue if unprocessed yet.
In the given code lines 12-17 happen for each vertex taken from the queue and before the next vertex is taken, line 18 happens which makes the color of the current vertex "BLACK". Now, due to line no. 13, this vertex will never be taken again due to any edge coming back. (This may not be the case if we were using DFS). So, even if lines 5 and 14 are remved thw algorithm works fine. We also do not need to see if parent is null to avoid a cycle.