3rd while loop-> else case

In else case, since copy->next was already null (if case), temp->next will get assigned null ? and break the linked list