We were getting a NullReferenceException from line 135 until I added the if statement on line 134.
It shouldn’t have been necessary because of the check on line 124.
I couldn’t reproduce it locally. But it happened every time on live for certain scenarios. This extension method is called from the SearchResultsViewModel constructor, but I wouldn’t think that would matter.
Am I missing something obvious?
This is how I call the extension method
ParseParentCategory(SearchKey)
This is how the SearchResultsViewModel is defined
Public Class SearchResultsViewModel
Inherits ViewModelBase
Public ReadOnly _ConstructedProperly As Boolean
Public Property SearchKey As String
Public Property ParentCategoryId As Integer = -1
Public Property ParentCategoryName As String
Public Sub New(Request As HttpRequestBase, pPartiallyPopulatedStupidInputModel As SearchResultsViewModel, pSearchBy As IProductsSearch.SearchBy)