kbatbouta / RimWorld-RocketMan

RocketMan is a RimWorld mod that is designed to improve RimWorld performance.
Eclipse Public License 2.0
48 stars 7 forks source link

[BUG] IndexOutOfRangeException in AlertsReadout_AlertsReadoutUpdate_Patch.ShouldUpdate #20

Closed acctforrandomstuff closed 3 years ago

acctforrandomstuff commented 3 years ago

Exception in UIRootUpdate: System.IndexOutOfRangeException: Index was outside the bounds of the array. at Proton.AlertsReadout_AlertsReadoutUpdate_Patch.ShouldUpdate (System.Int32 index) [0x00009] in :0 at (wrapper dynamic-method) RimWorld.AlertsReadout.RimWorld.AlertsReadout.AlertsReadoutUpdate_Patch0(RimWorld.AlertsReadout) at RimWorld.UIRoot_Play.UIRootUpdate () [0x00020] in <0feb66f0236b4f2faa0d13d3d46f45b1>:0

It seems Lines 217-221 of Proton.AlertsReadout_AlertsReadoutUpdate_Patch (Proton/Core/Patches/AlertsReadout_Patch.cs) is exceeding the index of the for loop at Line 169.

kbatbouta commented 3 years ago

Please provide the full report you full bug report. Lines 217-221 of Proton.AlertsReadout_AlertsReadoutUpdate_Patch has nothing to do with it. These are Harmony patches and have a different stack trace format.

Please provide all the information as mentioned in the issues format.

acctforrandomstuff commented 3 years ago

I'm sorry if this is not an issue for your project. I just searched for words from the exception and found this repo. I briefly looked over the code I saw the code below, which looks to me like it would produce the Index Out of Range exception.

for (int i = 0; i < codes.Length; i++)
{
    //...
        if (codes[i + 1].labels == null)
        {
            codes[i + 1].labels = new List<Label>();
        }
        codes[i + 1].labels.Add(l1);
    //...
}

Rimworld v1.2.3005 Rocketman v0.6.3.2191 HugsLib log: https://gist.github.com/HugsLibRecordKeeper/6292002801f6f7fcaaaa0a8706b85a87

Exception in UIRootUpdate: System.IndexOutOfRangeException: Index was outside the bounds of the array. at Proton.AlertsReadout_AlertsReadoutUpdate_Patch.ShouldUpdate (System.Int32 index) [0x00009] in <3d73fa4a5d264fae8483d91ee0f432a6>:0 at (wrapper dynamic-method) RimWorld.AlertsReadout.RimWorld.AlertsReadout.AlertsReadoutUpdate_Patch0(RimWorld.AlertsReadout) at (wrapper dynamic-method) RimWorld.UIRoot_Play.RimWorld.UIRoot_Play.UIRootUpdate_Patch1(RimWorld.UIRoot_Play)(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

kbatbouta commented 3 years ago

This code is patching code not a code that run every tick. This function is not even in the stack trace.

acctforrandomstuff commented 3 years ago

I apologize for taking up your time with this then. Can you tell from the log which mod(s) might be causing this exception?

kbatbouta commented 3 years ago

It's fixed. I added more checks for this bug.

Thanks for the report!