# Access violation exception with no stack trace

**URL:** <https://forums.unrealengine.com/t/access-violation-exception-with-no-stack-trace/1809955>\
**Category:** C++\
**Tags:** c-c, Debugging, c-class-wizard, c-and-bluepri, c-custommeshcomponen, c-and-blueprint, c-error, access-violation, c-class, c-custom-shape, c-programming, c-cone-shape, unreal-engine, crash, CPP, question\
**Created:** [April 18, 2024, 5:42pm UTC](https://forums.unrealengine.com/t/access-violation-exception-with-no-stack-trace/1809955 "2024-04-18T17:42:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hubert\_Lysias](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hubert\_Lysias](https://forums.unrealengine.com/u/Hubert_Lysias)\
**Post date:** [April 18, 2024, 5:42pm UTC](https://forums.unrealengine.com/t/access-violation-exception-with-no-stack-trace/1809955/1 "2024-04-18T17:42:43Z")

</div>

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:

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

```

Stack Trace:

```auto
<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.

---

<div class="post-metadata">

**Author:** ![GCasalis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GCasalis](https://forums.unrealengine.com/u/GCasalis)\
**Post date:** [April 18, 2024, 7:22pm UTC](https://forums.unrealengine.com/t/access-violation-exception-with-no-stack-trace/1809955/2 "2024-04-18T19:22:31Z")

</div>

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 😅

---

<div class="post-metadata">

**Author:** ![AK\_Ahmmad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AK\_Ahmmad](https://forums.unrealengine.com/u/AK_Ahmmad)\
**Post date:** [April 20, 2024, 11:24am UTC](https://forums.unrealengine.com/t/access-violation-exception-with-no-stack-trace/1809955/3 "2024-04-20T11:24:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hubert\_Lysias](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hubert\_Lysias](https://forums.unrealengine.com/u/Hubert_Lysias)\
**Post date:** [April 20, 2024, 11:53am UTC](https://forums.unrealengine.com/t/access-violation-exception-with-no-stack-trace/1809955/4 "2024-04-20T11:53:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [May 20, 2024, 11:54am UTC](https://forums.unrealengine.com/t/access-violation-exception-with-no-stack-trace/1809955/5 "2024-05-20T11:54:33Z")

</div>

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