Assuming the error is an access violation relating to the code that we can see, the only pointer dereferences in the if
statement are when you dereference Self
, and when you subsequently dereference ListViewLayers1
. So, the conclusion is that either you called the method on an invalid object instance, or that ListViewLayers1
is an invalid object instance.
If the exception is not such an access violation, then it is an exception raised by the getter for the Items
property.
Without any more code, or the actual exception details, it is difficult to say any more.