I've created a double linked list of car imported from a text file.
I have to use the insert function of my DLL to insert the records from the text file into the list but I received the following error.
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object at Untitled+Node..ctor () [0x00006] in <3d33487723864e3ba8eb4b8ade57b92b>:0 at Untitled+DoubleLinkedList.insert (Untitled+Dealer m) [0x0000b] in <3d33487723864e3ba8eb4b8ade57b92b>:0 at Untitled.Main (System.String[] args) [0x000af] in <3d33487723864e3ba8eb4b8ade57b92b>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object at Untitled+Node..ctor () [0x00006] in <3d33487723864e3ba8eb4b8ade57b92b>:0 at Untitled+DoubleLinkedList.insert (Untitled+Dealer m) [0x0000b] in <3d33487723864e3ba8eb4b8ade57b92b>:0 at Untitled.Main (System.String[] args) [0x000af] in <3d33487723864e3ba8eb4b8ade57b92b>:0
I know that it has something to do with something being null. Is the Dealer m constructor in the insert method not suppose to be there? Should I add the other remaining data variables?
Hopefully you guys could be of some great assistance.
using System;
using System.IO;
using System.Collections.Generic;
class Untitled 
{
    class Node
    {
        public Dealer data; 
        public Node prev;
        public Node next; 
        public Node()
        {
        data.make = "";
        data.model = "";
        data.year = 0;
        data.mileage = 0;
        data.price = 0; 
        prev = null;
        next = null; 
        } 
        public Node(Dealer m, Dealer md, Dealer y, Dealer mi, Dealer p, 
        Node forwards, Node backwards);
        {
            data = m;
            data = md; 
            data = y; 
            data = mi; 
            data = p; 
            prev = backwards;
            next = forwards;
        }
    }
    class DoubleLinkedList
    {
        public Node head;
        public Node tail; 
        public int size;
        public DoubleLinkedList()
        {
            head = null;
            tail = null;
            size = 0; 
        }
        //insert method
        public void insert(Dealer m)
        {
            if(head == null)
            {
                head = new Node();
                tail = head; 
            }
            else
            {
                tail.next = new Node();
                tail.next.prev = tail;
                tail = tail.next;
            }
        }
        //search method
    }
    public class Dealer
    {
        public string make; 
        public string model;
        public int year; 
        public double mileage; 
        public double price;
    }
}   
 
    