Access violation with "null pointer check"

anonymous_user_0358ed39
Sun, 24 Jun 2018 18:30:01 +0000
C++

I am getting random crashes in my project, all related to this line of code, that closes all doors:
The error is a "Access violation - code c0000005 … "

for (ATrainDoor* TrainDoor : TrainDoors)
{
if(TrainDoor) TrainDoor->CloseTrainDoor(bLock); ← this line
}

I allready added the check, to make sure it is not a null pointer, why am I still getting the error?
I feels like I am missing something very obvious…

4 posts - 1 participant