NullReferenceException at BuildUserPageError

Using PA to kill a player gave this error.

[Error] Failed to run a 0.01 timer in 'PlayerAdministration v1.5.26' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x002ca] in <bdb3c7c874c84cc19eda462acda9a843>:0
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in <bdb3c7c874c84cc19eda462acda9a843>:0
  at Oxide.Plugins.PlayerAdministration+<PlayerAdministrationKillUserCallback>c__AnonStorey1B.<>m__0 () [0x00028] in <bdb3c7c874c84cc19eda462acda9a843>:0
  at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <cf88a28c7fb44d36890d85a78331cc9d>:0
Could you provide more information please.

What the player online? Were they awake and roaming? Did they die when you ran the command? 
player was not online but sleeping, also not wearing the new spacesuit/skin. player died after command but just sent that to console also .... was wearing pants and hoodie ect.
nashslash
player was not online but sleeping, also not wearing the new spacesuit/skin. player died after command but just sent that to console also .... was wearing pants and hoodie ect.

Thank you, this helps and will investigate. 

there are no null checks so if an object is null it will throw a NullReferenceException

you need to add null checks for ServerUsers.User serverUser and BaseBlayer player objects, and also before you call AddUserPageInfoLabels. there might be more needed as well
20:48 [Error] Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in <00215ae23b5c44f4ac00d798404ad008>:0
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in <00215ae23b5c44f4ac00d798404ad008>:0
  at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in <00215ae23b5c44f4ac00d798404ad008>:0
  at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in <00215ae23b5c44f4ac00d798404ad008>:0
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ec05e0208c9149bba43236ca58fea105>:0
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <ec05e0208c9149bba43236ca58fea105>:0
same issue
crash in loop need update ?

Failed to call hook 'OnTeamLeave' on plugin 'Rustcord v2.5.1' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.Rustcord.OnTeamLeave (RelationshipManager+PlayerTeam team, BasePlayer player) [0x00031] in <a3d717c820194e3897ef7a49d389b2a2>:0

at Oxide.Plugins.Rustcord.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00e16] in <a3d717c820194e3897ef7a49d389b2a2>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ec05e0208c9149bba43236ca58fea105>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <ec05e0208c9149bba43236ca58fea105>:0

this actually throws out an error message for me when clicking a players name and the player is dead or no longer exists on the server..

Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.2' (NullReferenceException: Object reference not set to an instance of an object)
at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in <2ec2bc0b8e9045c4bd706f8c834fdc3d>:0
at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in <2ec2bc0b8e9045c4bd706f8c834fdc3d>:0
at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in <2ec2bc0b8e9045c4bd706f8c834fdc3d>:0
at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in <2ec2bc0b8e9045c4bd706f8c834fdc3d>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ec05e0208c9149bba43236ca58fea105>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <ec05e0208c9149bba43236ca58fea105>:0

not sure if it is the same for the OP.  Maybe it could display a message stating that the player info is unable to be displayed due to the player no longer existing or something?

running v1.6.02.

there was additional mods on the last update, which i took a look at.
it's not listed in the  revisions..... but  now it dicks about with a lot of un-needed string generation, where as before it was longs... with a conversion to a string when absolutly needed... (specifically related to missing players/missing corpses).
When  a player is in a game and goes into off line mode, then the body dissapears/destroyed..... there is a lot of boundry cases, since the player avatar only "comes back" when they rejoin. cleanup in rust is quite poor in these situations...

It becomes an issue when plugins start making assuptions on game state related to players in this state, like Teliporting & such.....

Ultimatly I decided to give the update a miss

Just FYI

Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.1' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in <780a37d306be411c95ce827e83d053fd>:0
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in <780a37d306be411c95ce827e83d053fd>:0
  at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in <780a37d306be411c95ce827e83d053fd>:0
  at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in <780a37d306be411c95ce827e83d053fd>:0
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in :0
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0
Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.2' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in :0 
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in :0 
  at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in :0 
  at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in :0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in :0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0 

Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.2' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in :0 
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in :0 
  at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in :0 
  at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in :0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in :0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0 

Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.2' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in :0 
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in :0 
  at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in :0 
  at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in :0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in :0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0 

Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.2' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in :0 
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in :0 
  at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in :0 
  at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in :0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in :0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0 

Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.2' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in :0 
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in :0 
  at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in :0 
  at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in :0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in :0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0 

When players are dead/online they are still showing on offline list.

here is the error, its on latest update.

at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in <2535371f1bcb4d85ac46548f67ad7203>:0
at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in <2535371f1bcb4d85ac46548f67ad7203>:0
at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in <2535371f1bcb4d85ac46548f67ad7203>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ec05e0208c9149bba43236ca58fea105>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <ec05e0208c9149bba43236ca58fea105>:0
Failed to run a 0.01 timer in 'PlayerAdministration v1.6.2' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in <85a080db7aa24291abd552b7d2d8a460>:0 
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in <85a080db7aa24291abd552b7d2d8a460>:0 
  at Oxide.Plugins.PlayerAdministration+<PlayerAdministrationKillUserCallback>c__AnonStorey1B.<>m__0 () [0x00028] in <85a080db7aa24291abd552b7d2d8a460>:0 

Failed to call hook 'PlayerAdministrationSwitchUICallback' on plugin 'PlayerAdministration v1.6.2' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.PlayerAdministration.BuildUserPage (Oxide.Plugins.PlayerAdministration+Cui& aUIObj, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.UInt64 aPlayerId) [0x0015f] in <85a080db7aa24291abd552b7d2d8a460>:0 
  at Oxide.Plugins.PlayerAdministration.BuildUI (BasePlayer aPlayer, Oxide.Plugins.PlayerAdministration+UiPage aPageType, System.String aArg, System.Boolean aIndFiltered) [0x000c1] in <85a080db7aa24291abd552b7d2d8a460>:0 
  at Oxide.Plugins.PlayerAdministration.PlayerAdministrationSwitchUICallback (Oxide.Core.Libraries.Covalence.IPlayer aPlayer, System.String aCommand, System.String[] aArgs) [0x001dd] in <85a080db7aa24291abd552b7d2d8a460>:0 
  at Oxide.Plugins.PlayerAdministration.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0148b] in <85a080db7aa24291abd552b7d2d8a460>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <80b90e8213db44b29ec2d4111764172c>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <ec05e0208c9149bba43236ca58fea105>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <ec05e0208c9149bba43236ca58fea105>:0

Missing null checks at lines 1411 1431 1454 1521 and inside the AddUserPageInfoLabels method are the cause of your exceptions

It would be better to store the player information such as displayName, ServerPosition, NetworkRotation etc in the Cui object when it's created on line 211. This way if the player is null later then you can use the last known information instead of displaying nothing.

so for example

at line 201:

			public string _networkRotation;
			public string networkRotation
			{
				get
				{
					if (FPlayer == null)
					{
						return _networkRotation;
					}
					
					return FPlayer.GetNetworkRotation().ToString();
				}
			}​

and _networkRotation = aPlayer.GetNetworkRotation().ToString(); when the Cui object is created

then line 1301 could replace `aPlayer.GetNetworkRotation()` with `aUIObj.networkRotation`

etc