Skip to content

Random crash due to access to equipped items #352

@enteryournamehere

Description

@enteryournamehere

just built the rocket in VE and the world server crashed.
rocket was not actually successfully built, was kicked out with the thinking cap still on

Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Collections.Generic.Dictionary`2.ValueCollection.CopyTo(TValue[] array, Int32 index)
   at System.Linq.Enumerable.ICollectionToArray[TSource](ICollection`1 collection)
   at Uchu.World.InventoryComponent.get_EquippedItems() in /home/me/projects/uchu/Uchu.World/Objects/Components/ReplicaComponents/InventoryComponent.cs:line 36
   at Uchu.World.InventoryComponent.PopEquippedItemState() in /home/me/projects/uchu/Uchu.World/Objects/Components/ReplicaComponents/InventoryComponent.cs:line 267
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

https://github.com/UchuServer/Uchu/blob/master/Uchu.World/Objects/Components/ReplicaComponents/InventoryComponent.cs

33        /// <summary>
34        /// The items currently equipped in the inventory
35        /// </summary>
36        public Item[] EquippedItems => Items.Values.ToArray();
...
// public async void PopEquippedItemState()
267       Debug($"Equipped Items: {EquippedItems.Length}");

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions