Access violation reading with skip list

I am doing Stroustrup’s PPP2 chapter 18 exercise 11: “Research and implement a skip list.”
This code gives the exception: Exception thrown at 0x00007FF61A3E656F in Skip List.exe: 0xC0000005: Access violation reading location 0x0000000000000020.

#include <iostream>
#include <vector>
#include <math.h>

// Error on lines 91 & 95: read-access violation: could be related to nullptr in constructors
// Only the first half is relevant to the exception
// 
const int maxLevel = 16;

class Node {
public:
    std::vector<Node*> next; // vector to hold next nodes at each level
    int value;

    Node(int value, int level) : value(value), next(level+1, nullptr) {}; // each node knows its position in the hierarchy, next vector is initialized to have level+1 elements, all set to 0

    void addNext(Node* node, int level) // add space for upcoming elements if next is not big enough
    {
        if (level >= next.size())
        {
            next.resize(level + 1, 0); 
        }
        next[level] = node;
    }

    ~Node() // destructor
    {
        for (auto& n : next)
        {
            delete n;
        }
    }
};

class skipList {
    int level;
    Node* head; // starting point of the skipList
    double P; // fraction/percentage of promotion
public:
    skipList() : level(1), head(), P(0.5) {}; // Default 
    skipList(int level, Node* head, double P) : level(level), head(head), P(P) // Constructor with parameters 
    {
        try {
            if (head == nullptr)
            {
                std::runtime_error("head can't be nullptr");
            }
        }
        catch (std::exception& e)
        {
            std::cerr << "Exception: " << e.what() << std::endl;
        }
        catch (...)
        {
            std::cerr << "Unkown Exception!" << std::endl;
        }
    }

    // main functions
    void insert(int value);
    void remove(int value);
    void search(int value);
    void display();

    // helper functions
    int randomNumber();
};

int skipList::randomNumber()  
{
    float r = (float)rand() / RAND_MAX;
    int lvl = 0;
    while (r < P && lvl < maxLevel)
    {
        lvl++;
        r = (float)rand() / RAND_MAX;
    }
    return lvl;
}

void skipList::insert(int value)
// Insert into base level
// Promote the inserted element depending on a probability
// Repeat until highest level or no promotion possible
try {
    //    Key of next node is less than key to be inserted then we keep on moving forward on the same level
    //    Key of next node is greater than the key to be inserted then we store the pointer to current node i at update[i] and move one level down and continue our search.
    Node* newNode = new Node(value, 0);
    Node** current = &head;

    for (int i = level; i >= 0; --i)
    {
        if (*current == nullptr) break;
        while ((*current)->value < value && *current != nullptr)
        {
            current = &(*current)->next[i]; // increment current, & returns address of pointer to next
        }
        if (*current != nullptr || (*current)->value > value) 
            // reached point of insertion or end of level
        {
            break;
        }
        else
        {
            newNode->addNext(*current, i);
            *current = newNode;
        }
    }

    int rlvl = randomNumber(); // generate random level for node
    // If level is increasing
    if (rlvl <= maxLevel && rlvl != level)
    {
        //Add new nodes at the top level
        for (int i = level; i < rlvl; ++i)
        {
            newNode->addNext(newNode, i); 
        }
        // Update the head pointer
        head = newNode;
        level = rlvl; 
    }
}
catch (std::exception& e)
{
    std::cerr << "Exception: " << e.what() << std::endl;
}
catch (...)
{
    std::cerr << "Unkown Exception!n";
}

void skipList::display()
// Function to display the skipList
{
    std::cout << "nnt---skipList---nn";
    for (int i = level; i >= 0; i--) // start at top level, go down
    {
        Node* temp = head;
        while (temp != nullptr)
        {
            std::cout << temp->value << " ";
            temp = temp->next[i];
        }
        std::cout << std::endl;
    }
}

int main()
{
    // seed randnum generator
    srand((unsigned)time(0));

    // insert() test
    Node node(1, 1);
    skipList SkipList(1, &node, 0.5);

    for (int i = 1; i <= 15; i++)
    {
        SkipList.insert(i); 
    }
    SkipList.display();   
}

After removing certain pieces of the code, it seems like the issue is me dereferencing a nullptr in the nested while loop and if statement in skipList::insert(): (*current)->value >/< value. When I get rid of this piece of code, it runs but outputs nothing. I have added a cout before this if statemment: if (*current == nullptr) break;, and it outputs a bunch of 0’s, which I assume means its a nullptr. I’ve tried changing around my constructors but nothing I do seems to fix it.
Any help is appreciated! Thanks in advance!

New contributor

Channing Moor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật