# Blueprint Runtime Error: "Attempted to access index 0 from array GameDate of length 0!

**URL:** <https://forums.unrealengine.com/t/blueprint-runtime-error-attempted-to-access-index-0-from-array-gamedate-of-length-0/438939>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [December 6, 2018, 1:33pm UTC](https://forums.unrealengine.com/t/blueprint-runtime-error-attempted-to-access-index-0-from-array-gamedate-of-length-0/438939 "2018-12-06T13:33:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Silent\_Destino](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Silent\_Destino](https://forums.unrealengine.com/u/Silent_Destino)\
**Post date:** [December 6, 2018, 1:33pm UTC](https://forums.unrealengine.com/t/blueprint-runtime-error-attempted-to-access-index-0-from-array-gamedate-of-length-0/438939/1 "2018-12-06T13:33:48Z")

</div>

Hello

I keep getting this error within my script and I have no clue what it wants from me. I am attaching a screenshot from the engine . I am following the 3 Prong Gaming RTS tutorial!  
I appreciate all your help

 ![261427-screenshot-9.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/c/d3cc25f3f29ff550f5199d52ebc396a4c316cbee.jpeg)

 ![261428-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/9/e396359c1556e581d2d72fc094e12a0dde507657.jpeg)

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [December 6, 2018, 2:12pm UTC](https://forums.unrealengine.com/t/blueprint-runtime-error-attempted-to-access-index-0-from-array-gamedate-of-length-0/438939/2 "2018-12-06T14:12:05Z")

</div>

It means that the Game Date array is empty when the Return Node tries to get something from it.

---

<div class="post-metadata">

**Author:** ![Weibye](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Weibye](https://forums.unrealengine.com/u/Weibye)\
**Post date:** [December 6, 2018, 2:24pm UTC](https://forums.unrealengine.com/t/blueprint-runtime-error-attempted-to-access-index-0-from-array-gamedate-of-length-0/438939/3 "2018-12-06T14:24:52Z")

</div>

You can’t get item at index 0 from an array that has no items.  
To stop this error from happening, (edit: and to prevent yourself from running code on nothing) do the following any time you are working with an array:

Array → get length of array → if length is more than 0 → do code

Edit: This makes sure you never try to access something from an array that has no members. **Now, your actual problem is that the array is empty in the first place and you need to look into whatever code that adds objects to the array.**

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [December 6, 2018, 2:54pm UTC](https://forums.unrealengine.com/t/blueprint-runtime-error-attempted-to-access-index-0-from-array-gamedate-of-length-0/438939/4 "2018-12-06T14:54:34Z")

</div>

You have to be careful with that, though. If you implement that check, you will get no errors or warnings, but that’s not the result you need. What you need is your blueprints to do what you want them to do, and not just not give you any errors. When you see that the array is empty, you have to find out why. You have to add an element to the array somewhere, either manually or in a blueprint at runtime.  
  
  
A screenshot of the blueprint that calls the Get Day function might be helpful.

---

<div class="post-metadata">

**Author:** ![Weibye](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Weibye](https://forums.unrealengine.com/u/Weibye)\
**Post date:** [December 7, 2018, 9:49am UTC](https://forums.unrealengine.com/t/blueprint-runtime-error-attempted-to-access-index-0-from-array-gamedate-of-length-0/438939/5 "2018-12-07T09:49:30Z")

</div>

Agreed, updated answer to be a bit more clarifying.

---

<div class="post-metadata">

**Author:** ![Silent\_Destino](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Silent\_Destino](https://forums.unrealengine.com/u/Silent_Destino)\
**Post date:** [December 7, 2018, 11:13am UTC](https://forums.unrealengine.com/t/blueprint-runtime-error-attempted-to-access-index-0-from-array-gamedate-of-length-0/438939/6 "2018-12-07T11:13:51Z")

</div>

I have checked everything and I had a Branch with a boolean that was not supplying the correct information. I had to check all my blueprints in the whole game but it was fixed :)! Thanks for the help guys!
