UnlimitedHugs / RimworldHugsLib

A lightweight shared library for Rimworld modding.
Other
244 stars 59 forks source link

Dialog_Options errors when searching mod options #93

Closed thakyZ closed 2 months ago

thakyZ commented 1 year ago

So while having only HugsLib and Harmony and all the DLCs plus 1.4 enabled. Attempting to search "huh" in the mod options' menu breaks the game and spams the debug console.

https://gist.github.com/7ee6c34db41c804b7949d124d9eaab6c

I specifically searched "huh" because the letter after g in hug is h. Otherwise, it would seem any other combination works as well.

thakyZ commented 1 year ago

I did some testing with a help of a friend. We inserted some code into the class DialogOptions_DoModOptions_Patch

[HarmonyPrefix]
public static void DoModOptions_Patch(Dialog_Options __instance) {
    IEnumerable<Mod> t = Traverse.Create(__instance).Field("cachedModsWithSettings").GetValue() as IEnumerable<Mod>;
    foreach (Mod mod in t)
    {
        Log.Message(mod.SettingsCategory().ToLower());
        Log.Message("EndOfSettingsCat");
        Log.Message(mod.Content.Name.ToLower());
        Log.Message("EndOfModContent");
    }
    Log.Message("EndOfFoorLoop");
}

And it seems to always error when trying to output for mod.Content.Name.ToLower()

And now it seems like a vanilla bug to be honest.

EDIT: Here is the log from testing; https://gist.github.com/ec9095b82b02bac01c13584d9afd7448

thakyZ commented 1 year ago

I just figured it out:

public SettingsProxyMod(string entryLabel, ModSettingsPack settingsPack) : base(null) {
    SettingsPack = settingsPack;
    this.entryLabel = entryLabel;
}

File: OptionsDialogExtensions.cs | Line 60

The base class of SettingsProxyMod casts null unto the content argument for the constructor of Verse.Mod

UnlimitedHugs commented 2 months ago

Should have been resolved as part of the 1.5 update.