I love this code smell. First I find the solution to be fascinating. Second, the indicator (checking for null) is often…