Access violation exception with no stack trace

Hi,

I am facing Access Violation exception. It seems to occur when I try to play the game a second time from within the editor. The catch is, there is no proper stack trace, so I don’t know where to look at, to find the problem.

I recently made some local changes to the code and I’m pretty sure it’s due to those changes, cos when I stash them, the game seems to work fine. I’m guessing there’s an infinite loop somewhere, cos it keeps crash at the same place multiple times, but I can’t think of anywhere there could an infinite loop.

Exception:

Exception: Exception 0xc0000005 encountered at address 0x7ff857dda753: Access violation reading location 0x3f80000c

Stack Trace:

<unknown> 0x00007ff857dda753
<unknown> 0x00007ff857dff5bd
<unknown> 0x00007ff857d8e393
<unknown> 0x00007ff857dd1fa8
<unknown> 0x00007ff857d856f7
<unknown> 0x00007ff857d27f74
<unknown> 0x00007ff85cc68cd5
<unknown> 0x00007ff85cc68a7c
<unknown> 0x00007ff85cc480e2
<unknown> 0x00007ff85cc908c2
<unknown> 0x00007ff85cc58b60
<unknown> 0x00007ff85ce3f773
<unknown> 0x00007ff85d274e32
<unknown> 0x00007ff85d26872d
<unknown> 0x00007ff8fb41257d
<unknown> 0x00007ff8fcf2aa48

I’ve searched the internet as per my knowledge and nothing helped. Any help in debugging this would be greatly appreciated.

I think this exception is relating to trying to access an address which you have not properly intialised.

For example if you create an array of 10 elements then try to access the 11th element you will get this exception.

Or you think you have a pointer to an Actor but you actually have a nullptr.

This is where you could use TArrays array.IsValidIndex(index) or IsValid(actorPtr) for example.

If you want to catch these exceptions more intentionally you can use check(array.IsValidIndex(index)) which will assert that the index is valid then hopefully raise an exception pointing to that line. I think :sweat_smile:

Check your code and see if you have any array that is populating something, add Clear array before the population.

Looks like the problem was, I was using an array of pointers to an interface, something like TArray<ITickActorInterface*>. Seems to be working now after I changed it to TArray<AActor*> and I just casted it to ITickActorInterface wherever I needed in code.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.