Bug in Linked Lists

fixed NULL pointer dereferencing in linked list