aalhour / C-Sharp-Algorithms

:books: :chart_with_upwards_trend: Plug-and-play class-library project of standard Data Structures and Algorithms in C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Mabar16 opened this issue · comments

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.