How can the if statement in the following snippet of code throw a null pointer exception in my LinkedList class? Isn't it 'handled' per-say by the if statement?
if(iter.getNext() == null) {
iter.setNext(new ListElement(data, null)); // set the new tail
return head;
}