Getting rid of NullReferenceException

Photo by Mitchell Luo on Unsplash

NullReferenceException is one of the most common exceptions we face when developing systems. This kind of exception is raised when trying to access some property or value from an object that is null.

We as developers sometimes forget to cover scenarios where the information could not exist, for example, when we try to recover a resource from a database through some unique id and this resource does…