NullReferenceException at AddActiveButtonFixed

FIX:

Replace these two functions... the "First(...)" stuff doesn't work, but is not even needed for what it is supposed to do...

private static void AddNonActiveButton(
			int tabIndex,
			CuiElementContainer container,
			HelpTab helpTab,
			string mainPanelName,
			string activeTabButtonName)
		{
			Color nonActiveButtonColor;
			ColorExtensions.TryParseHexString(_settings.InactiveButtonColor, out nonActiveButtonColor);

			CuiButton helpTabButton = CreateTabButton(tabIndex, helpTab, nonActiveButtonColor);
			string helpTabButtonName = container.Add(helpTabButton, mainPanelName);
			string command = string.Format("changeTab {0} {1} {2} {3}", tabIndex, activeTabButtonName, helpTabButtonName, mainPanelName);
			helpTabButton.Button.Command = command;
		}

		private static string AddActiveButton(
			int activeTabIndex,
			HelpTab activeTab,
			CuiElementContainer container,
			string mainPanelName)
		{
			Color activeButtonColor;
			ColorExtensions.TryParseHexString(_settings.ActiveButtonColor, out activeButtonColor);
			
			var activeHelpTabButton = CreateTabButton(activeTabIndex, activeTab, activeButtonColor);
			var activeTabButtonName = container.Add(activeHelpTabButton, mainPanelName);
			var command = string.Format("changeTab {0}", activeTabIndex);

			activeHelpTabButton.Button.Command = command;
			return activeTabButtonName;
		}

Heres my error

| Failed to run a 2.00 timer in 'ServerInfo v0.5.6' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.ServerInfo+<AddActiveButton>c__AnonStorey5.<>m__0 (Oxide.Game.Rust.Cui.CuiElement i) [0x00006] in <a78c3886822340d5924c64c1d22d890d>:0 
  at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found) [0x0003f] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00000] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at Oxide.Plugins.ServerInfo.AddActiveButton (System.Int32 activeTabIndex, Oxide.Plugins.ServerInfo+HelpTab activeTab, Oxide.Game.Rust.Cui.CuiElementContainer container, System.String mainPanelName) [0x00030] in <a78c3886822340d5924c64c1d22d890d>:0 
  at Oxide.Plugins.ServerInfo.ShowInfo (BasePlayer player, System.String command, System.String[] args) [0x000f3] in <a78c3886822340d5924c64c1d22d890d>:0 
  at Oxide.Plugins.ServerInfo.OnPlayerConnected (BasePlayer player) [0x000dc] in <a78c3886822340d5924c64c1d22d890d>:0 
  at Oxide.Plugins.ServerInfo+<OnPlayerConnected>c__AnonStorey2.<>m__0 () [0x00000] in <a78c3886822340d5924c64c1d22d890d>:0 
  at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <46ff2b534abb4b35952608167523b7ec>:0​

NEED UPDATE this plugin

(21:15:04) | Failed to run a 2.00 timer in 'ServerInfo v0.5.6' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.ServerInfo+<AddActiveButton>c__AnonStorey5.<>m__0 (Oxide.Game.Rust.Cui.CuiElement i) [0x00006] in <a5152fb8b79449d4a92a8ce388db87d2>:0

at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found) [0x0003f] in <351e49e2a5bf4fd6beabb458ce2255f3>:0

at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00000] in <351e49e2a5bf4fd6beabb458ce2255f3>:0

at Oxide.Plugins.ServerInfo.AddActiveButton (System.Int32 activeTabIndex, Oxide.Plugins.ServerInfo+HelpTab activeTab, Oxide.Game.Rust.Cui.CuiElementContainer container, System.String mainPanelName) [0x00030] in <a5152fb8b79449d4a92a8ce388db87d2>:0

at Oxide.Plugins.ServerInfo.ShowInfo (BasePlayer player, System.String command, System.String[] args) [0x000f3] in <a5152fb8b79449d4a92a8ce388db87d2>:0

at Oxide.Plugins.ServerInfo.OnPlayerConnected (BasePlayer player) [0x000dc] in <a5152fb8b79449d4a92a8ce388db87d2>:0

at Oxide.Plugins.ServerInfo+<OnPlayerConnected>c__AnonStorey2.<>m__0 () [0x00000] in <a5152fb8b79449d4a92a8ce388db87d2>:0

at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <46ff2b534abb4b35952608167523b7ec>:0

Thanks Doc, works great :)

Plugin compiles but all buttons on the left side disappeared.
So that isn't a valid fix for me, when 9 out of 10 sites can not be read^^

you think we're all devs why don't you create an update....

Toliman

Plugin compiles but all buttons on the left side disappeared.
So that isn't a valid fix for me, when 9 out of 10 sites can not be read^^

you sure you didn't delete too much by accident? (especially not the CreateTabButton function below?)

or create link to download i canot see this

HqgDslGHyj4gUXy.jpg Killeroox

or create link to download i canot see this

The plugin was already updated with the changes.

Works for me.. all buttons are there. hope it works for all

YYfHEvDw8BvEw2T.png Wulf

The plugin was already updated with the changes.

sorry wolf, didnt see you upload..

The code changes works for me. (we only use one tab though so cant say anything about that)

The update works for us. Thanks. 

Thanks for the patch Wulf :)

Only in rust do people complain about getting a quick patch handed to them for free, just because it's not on a silver platter xD

Wulf NooBlet and DocValerian thank you for the fast patch.

Locked automatically