Forum rules - please read before posting.

Containers Rage Quitting After Clicking an Empty Slot

I have a container with two items, and if I ever click an empty slot, it pauses the game and outputs this error.

ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[AC.ContainerItem].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
AC.MenuInventoryBox.ClickContainer (MouseState _mouseState, Int32 _slot, AC.Container container) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInventoryBox.cs:751)
AC.RuntimeInventory.ProcessInventoryBoxClick (AC.Menu _menu, AC.MenuInventoryBox inventoryBox, Int32 _slot, MouseState _mouseState) (at Assets/AdventureCreator/Scripts/Inventory/RuntimeInventory.cs:1183)
AC.MenuInventoryBox.ProcessClick (AC.Menu _menu, Int32 _slot, MouseState _mouseState) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInventoryBox.cs:789)
AC.PlayerMenus.CheckClick (AC.Menu _menu, AC.MenuElement _element, Int32 _slot, MouseState _mouseState) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:1239)
AC.PlayerMenus.CheckClicks (AC.Menu menu) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:1052)
AC.PlayerMenus.UpdateAllMenus () (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:1160)
AC.StateHandler.Update () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:132)

Any ideas what the cause or fix would be?

Thanks,
Josh

Comments

  • This is the line of code it points too as well.

    if (container.items [_slot+offset] != null)
    {
    ContainerItem containerItem = container.items [_slot + offset];
    KickStarter.runtimeInventory.Add (containerItem.linkedID, containerItem.count, selectItemsAfterTaking, -1);
    container.items.Remove (containerItem);
    }
  • Change that first line to:

    if (container.items.Count > (_slot+offset) && container.items [_slot+offset] != null)

    I'll make that a bugfix in the next release, too.
  • Awesome, thanks Chris!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.