# Providing wrong Material Slot Names crash the Engine

**URL:** <https://forums.unrealengine.com/t/providing-wrong-material-slot-names-crash-the-engine/383632>\
**Category:** Asset Creation\
**Tags:** unreal-engine, bug-report, question, Blueprint\
**Created:** [February 1, 2017, 4:25pm UTC](https://forums.unrealengine.com/t/providing-wrong-material-slot-names-crash-the-engine/383632 "2017-02-01T16:25:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raildex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Raildex](https://forums.unrealengine.com/u/Raildex)\
**Post date:** [February 1, 2017, 4:25pm UTC](https://forums.unrealengine.com/t/providing-wrong-material-slot-names-crash-the-engine/383632/1 "2017-02-01T16:25:25Z")

</div>

When providing a Material Slot Name in the “Get Material Index” tha mesh does not have and plugging the index into “Get Material”, the Engine Crashes

[![](https://d3kjluh73b9h9o.cloudfront.net/original/3X/2/0/20002faf28adfd94ca98cf6ced46f14334b53684.png) ](https://i.imgur.com/removed.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [February 1, 2017, 5:12pm UTC](https://forums.unrealengine.com/t/providing-wrong-material-slot-names-crash-the-engine/383632/2 "2017-02-01T17:12:41Z")

</div>

Hey Raildex\_-

Where are you setting up this blueprint? What is in the Material Slots array? Can you provide all of the setup steps that lead to the crash? Also, can you provide the callstack and log files from the crash for additional information?

---

<div class="post-metadata">

**Author:** ![S-ed](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s-ed/32/1194558_2.png) [@S-ed](https://forums.unrealengine.com/u/S-ed)\
**Post date:** [February 1, 2017, 5:30pm UTC](https://forums.unrealengine.com/t/providing-wrong-material-slot-names-crash-the-engine/383632/3 "2017-02-01T17:30:44Z")

</div>

May be useful: [A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums](https://wiki.unrealengine.com/Locating_Project_Logs)

---

<div class="post-metadata">

**Author:** ![Raildex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Raildex](https://forums.unrealengine.com/u/Raildex)\
**Post date:** [February 2, 2017, 9:15am UTC](https://forums.unrealengine.com/t/providing-wrong-material-slot-names-crash-the-engine/383632/4 "2017-02-02T09:15:50Z")

</div>

1. Take any Mesh (Static Mesh or Skeletal Mesh) and see what Material Slot Names it uses
2. Put it into a Blueprint.
3. use the Get Material Index() Node at BeginPlay, provide a name of a valid Material Slot.
4. Plug the resulting Index into “Get Material()” Node
5. Output the resulting Material into Print String
6. Execture. Everything works as intended
7. Change the Material Name to something not correct
8. Execture again. You’ll see the Game crashes when you try to retrieve the Material. The Material Index returned is -1. The Crash is caused by getMaterial()

Crash Report:

> **[LoginId:a2c278d349fd7b23a34ca7abf9736cccEpicAccountId:a580d785848d4edaaf6f3438...](https://pastebin.com/fSGXSUma)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

(Array Index out of bounds, because of get Material Index is -1)

Log:

> **[Log file open, 02/02/17 10:05:05LogInit:Display: Running engine for game: Lara...](https://pastebin.com/ap5CfCpr)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [February 8, 2017, 7:21pm UTC](https://forums.unrealengine.com/t/providing-wrong-material-slot-names-crash-the-engine/383632/5 "2017-02-08T19:21:23Z")

</div>

Hey Raildex\_-

The crash you’re seeing is caused by the return value of your Get Material Index node. When the slot name is invalid, the return value is -1. Using this value in the Get Material node, which is searching an array, causes the crash b/c -1 is always outside of the array bounds. I have reproduced the issue and have created a report for it here [Unreal Engine Issues and Bug Tracker (UE-41774)](https://issues.unrealengine.com/issue/UE-41774) . You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers
