# Widget Switcher Array Index Crash \[Repro\]

**URL:** <https://forums.unrealengine.com/t/widget-switcher-array-index-crash-repro/337644>\
**Category:** UI\
**Tags:** unreal-engine, crash, bug-report, slate, Widget, question, UMG\
**Created:** [November 6, 2015, 11:20am UTC](https://forums.unrealengine.com/t/widget-switcher-array-index-crash-repro/337644 "2015-11-06T11:20:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [November 6, 2015, 11:20am UTC](https://forums.unrealengine.com/t/widget-switcher-array-index-crash-repro/337644/1 "2015-11-06T11:20:16Z")

</div>

If you delete a widget from a Widget Switcher in UMG, but the ‘Active Widget Index’ is assigned to the last Widget, you’ll get an Array Access Violation and a crash.

This is easy to reproduce:

1. Create a new UMG User Widget in the Content Browser and add a ‘Widget Switcher’ item to it.
2. Add **three** children to the widget switcher (doesn’t matter what they are).
3. Select the Widget Switcher and set the ‘Active Widget Index’ to ‘2’
4. Now drag-and-drop the last child of the Widget switcher to another widget, or delete it entirely.
5. Select the first child again. (if you skip this step, the crash won’t occur).
6. Try to select the Widget switcher. You should get an instant crash.

This is caused by the ‘Active Widget Index’ still being set to ‘2’ - even though child 2 no longer exists but the Array of children has already been resized. Forcing the Active Widget Index value to 0 when a child is deleted would easily fix this issue.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [November 6, 2015, 2:56pm UTC](https://forums.unrealengine.com/t/widget-switcher-array-index-crash-repro/337644/2 "2015-11-06T14:56:31Z")

</div>

Hello ,

After doing a big of digging I found that this is a known issue (UE-19741) and it has been resolved internally. I have provided a link to the commit below. If you are working from source you could cherry pick this solution and pull it down into your project. I hope that this information helps.

Link to commit: [https://github.com/EpicGames/UnrealEngine/commit/d304f9cb9d58b4037e39cf22a486c209ffd4d036](https://github.com/EpicGames/UnrealEngine/commit/d304f9cb9d58b4037e39cf22a486c209ffd4d036)

Make it a great day

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [November 6, 2015, 4:12pm UTC](https://forums.unrealengine.com/t/widget-switcher-array-index-crash-repro/337644/3 "2015-11-06T16:12:50Z")

</div>

Great stuff, thanks Rudy!
