deleting from a linked list if there are just 2 nodes
i'm having some trouble with a function i am trying to write. i cannot delete the second node from a DOUBLY linkedlist if there are just two nodes. here is a snippet of code within my function but i keep getting a segmentation fault, am i doing something wrong because if i comment this part of my code out it works fine:
Node<T> *secondNode = first->next;
if(secondNode->next==NULL) //check if there is just 2 nodes.
first->next = secondNode->next;