A Null Reference exception could occur at runtime?

Hi,

Is there anything wrong with the following?

Private Function DeletedFilter(ByVal item As Object) As Boolean
Try
If item.ComponentState <> IComponentState.eComponentState.Deleted Then
If TypeOf item Is ComplexComponent Then
If item.Components IsNot Nothing Then
Dim cv As ICollectionView = CollectionViewSource.GetDefaultView(item.Components)
cv.Filter = New Predicate(Of Object)(AddressOf DeletedFilter)
End If
Return True
Else
Return True
End If
Else
Return False
End If
Catch ex As Exception
MessageBox.Show("Error during " & Reflection.MethodBase.GetCurrentMethod().Name & "." _
& vbCrLf & ex.Message _
, ModuleName & " Error..." _
, MessageBoxButtons.OK _
, MessageBoxIcon.Error)
Return False
End Try
End Function

Please sign in to leave a comment.