Head of Linked List Returning as nullptr Despite Setting it to an Address

I'm creating a doubly-linked list and attempting to set head to the address of the node I create using the new operator. However, head seems to always returns as nullptr, which leads me to not be able to store a value within the node.

I created a header called LinkedList.h that has an instance variable called head inside of a template class. This is how head is defined:

node<genericType> *head;

I include that header in a class called Container, that has an instance variable called list, which is an instance of the template class LinkedList:

LinkedList<genericType> list;

I've also defined three more functions, getList(), getHead(), and setHead():

node<genericType> getList()    <-This is inside of Container
{
    return list;
}

node<genericType> *getHead()    <-This is inside of LinkedList
{
    return head;
}

void setHead(node<genericType> *inputNode)    <-This is inside of LinkedList
{
    head = inputNode;
}

This is the series of statements the program passes through:

if (getList().getHead() == nullptr)
{
    getList().setHead(new node<genericType>);
    getList().getHead();    //FOR DEBUGGING PURPOSES
    getList().getHead()->val = value;
    getList().setTail(getList().getHead());
}

Stepping through with the MSVC debugger, this is what I've gathered:

getList().setHead(new node<genericType>);
  • new creates a new node with a valid address
  • It is then assigned to head.

enter image description here

getList().getHead();
  • Head is returned as nullptr, even though it was assigned to the new node created.

enter image description here

Why is this happening, considering it's the same LinkedList object?