ow-mods/owml

Menu Separators sometimes broken in the pause Menu

salomj opened this issue · 2 comments

Steps to reproduce

  1. Add two or more separators to the default-config.json for a mod
  2. Verify that is works on the title screen mod menu
  3. Start the game, and try to open the pause mod menu

Stacktrace

Menu system crashed: System.NullReferenceException 
	at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object) 
	at UnityEngine.Object.get_name () [0x00001] in <d9a322ed61d14dd89945ee0a494ae01f>:0 
	at OWML.ModHelper.Menus.ModMenu+<>c__DisplayClass62_0.<GetSeparator>b__0 (OWML.Common.Menus.IModSeparator x) [0x00019] in <d6c48abff5fb4b58ab37984165ca214f>:0 
	at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x0002c] in <55b3683038794c198a24e8a1362bfc61>:0 
	at OWML.ModHelper.Menus.ModMenu.GetSeparator (System.String title) [0x00013] in <d6c48abff5fb4b58ab37984165ca214f>:0 
	at OWML.ModHelper.Menus.ModMenu.SetInputValue (System.String key, System.Object value) [0x0014d] in <d6c48abff5fb4b58ab37984165ca214f>:0 
	at OWML.ModHelper.Menus.ModConfigMenu.UpdateUIValues () [0x00053] in <d6c48abff5fb4b58ab37984165ca214f>:0 
	at OWML.ModHelper.Menus.ModsMenu.InitConfigMenu (OWML.Common.Menus.IModConfigMenuBase modConfigMenu, OWML.Common.Menus.IModTabbedMenu options, OWML.Common.Menus.IModTabMenu modTabMenu) [0x000ef] in <d6c48abff5fb4b58ab37984165ca214f>:0 
	at OWML.ModHelper.Menus.ModsMenu.CreateBlockOfButtons (OWML.Common.Menus.IModTabbedMenu options, OWML.Common.Menus.IModTabMenu menu, System.Collections.Generic.List`1[T] configMenus, System.Int32 index, System.String title) [0x000b3] in <d6c48abff5fb4b58ab37984165ca214f>:0 
	at OWML.ModHelper.Menus.ModsMenu.Cre
	ateModsMenu (OWML.Common.Menus.IModTabbedMenu options) [0x0009f] in <d6c48abff5fb4b58ab37984165ca214f>:0 
	at OWML.ModHelper.Menus.ModsMenu.Initialize (OWML.Common.Menus.IModMenus menus, OWML.Common.Menus.IModOWMenu owMenu) [0x0007b] in <d6c48abff5fb4b58ab37984165ca214f>:0 
	at OWML.ModHelper.Menus.ModMenus.InitPauseMenu (PauseMenuManager pauseMenuManager) [0x0001c] in <d6c48abff5fb4b58ab37984165ca214f>:0

Don't worry, this is my fault, so I'll take this one., and thankfully separators are also not listed anywhere in the documentation, so that is good as well.

Looks like the issue is that in UnityEngine.Object.GetName(this) this is null.

Looks like it might be a cleanup issue, as it seems that multiple items in the Separators list have Element == null.