Skip to content

Program crashes upon search for null in a SkipList<string> #140

Open
@Mabar16

Description

@Mabar16

Describe the bug
Attempting to search for null in a SkipList results in the application crashing due to a NullReferenceException

To Reproduce
Steps to reproduce the behavior:

  1. Create a new SkipList<string>
    var skipList = new SkipList<string>():
  2. Try to search for null
    list.Contains(null)

Expected behavior
I expected this SkipList to have the same behaviour as the standard C# List implementation when processing null. Applying the same steps to a standard C# List will result in list.Contains(null) evaluating to false without crashing.

Environment:
OS: Windows 10 Home (Version 10.0.18362 Build 18362)
.NET Version: .NET Core v3.1.101
IDE: Microsoft Visual Studio Community 2019 - Version 16.4.5

Additional context
Bug can be reproduced with any of the functions that make use of the SkipList's built-in comparator: Remove, Find, Contains, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions