FabioZumbi12 / SEDiscordBridge

A Torch plugin to connect the SE server to Discord
MIT License
13 stars 11 forks source link

Plugin crashing when player connected on restart #10

Closed theCalcaholic closed 5 years ago

theCalcaholic commented 6 years ago

When a player connects to the server while the game is still starting (more easily happening now because of the auto reconnect function of the latest SE build) - or maybe just when cancelling said connection attempt, SEDiscordBridge seems to crash with the following stack trace:

01:24:53.5207 [INFO]   Torch.Managers.MultiplayerManagerBase: ID:76561198065272056 (76561198065272056) Disconnected.
01:24:54.0002 [FATAL]  Initializer: System.NullReferenceException: Object reference not set to an instance of an object.
   at SEDiscordBridge.DiscordBridge.MentionNameToID(String msg, DiscordChannel chann) in D:\SpaceEngineersMod\TorchPlugins\SEDiscordBridge\SEDiscordBridge\DiscordBridge.cs:line 221
   at SEDiscordBridge.DiscordBridge.SendStatusMessage(String user, String msg) in D:\SpaceEngineersMod\TorchPlugins\SEDiscordBridge\SEDiscordBridge\DiscordBridge.cs:line 107
   at SEDiscordBridge.SEDicordBridgePlugin._multibase_PlayerLeft(IPlayer obj) in D:\SpaceEngineersMod\TorchPlugins\SEDiscordBridge\SEDiscordBridge\SEDicordBridgePlugin.cs:line 158
   at System.Action`1.Invoke(T obj)
   at Torch.Managers.MultiplayerManagerBase.OnClientLeft(UInt64 steamId, MyChatMemberStateChangeEnum stateChange)
   at System.Action`2.Invoke(T1 arg1, T2 arg2)
   at Sandbox.Engine.Multiplayer.MyMultiplayerBase.RaiseClientLeft(UInt64 changedUser, MyChatMemberStateChangeEnum stateChange)
   at Sandbox.MySandboxGame.ProcessInvoke()
   at Sandbox.MySandboxGame.Update()
   at Sandbox.Engine.Platform.Game.UpdateInternal()
   at Sandbox.Engine.Platform.Game.RunSingleFrame()
   at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass1.<Run>b__0()
   at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)
   at Sandbox.Engine.Platform.Game.RunLoop()
   at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen)
   at Torch.VRageGame.DoStart()
   at Torch.VRageGame.Run()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
System.NullReferenceException: Object reference not set to an instance of an object.
   at SEDiscordBridge.DiscordBridge.MentionNameToID(String msg, DiscordChannel chann) in D:\SpaceEngineersMod\TorchPlugins\SEDiscordBridge\SEDiscordBridge\DiscordBridge.cs:line 221
   at SEDiscordBridge.DiscordBridge.SendStatusMessage(String user, String msg) in D:\SpaceEngineersMod\TorchPlugins\SEDiscordBridge\SEDiscordBridge\DiscordBridge.cs:line 107
   at SEDiscordBridge.SEDicordBridgePlugin._multibase_PlayerLeft(IPlayer obj) in D:\SpaceEngineersMod\TorchPlugins\SEDiscordBridge\SEDiscordBridge\SEDicordBridgePlugin.cs:line 158
   at System.Action`1.Invoke(T obj)
   at Torch.Managers.MultiplayerManagerBase.OnClientLeft(UInt64 steamId, MyChatMemberStateChangeEnum stateChange)
   at System.Action`2.Invoke(T1 arg1, T2 arg2)
   at Sandbox.Engine.Multiplayer.MyMultiplayerBase.RaiseClientLeft(UInt64 changedUser, MyChatMemberStateChangeEnum stateChange)
   at Sandbox.MySandboxGame.ProcessInvoke()
   at Sandbox.MySandboxGame.Update()
   at Sandbox.Engine.Platform.Game.UpdateInternal()
   at Sandbox.Engine.Platform.Game.RunSingleFrame()
   at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass1.<Run>b__0()
   at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)
   at Sandbox.Engine.Platform.Game.RunLoop()
   at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen)
   at Torch.VRageGame.DoStart()
   at Torch.VRageGame.Run()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
ProsperCraft commented 6 years ago

We are crashing as well, it was running fine, now I had to disable this plugin.

https://gist.github.com/ProsperCraft/cadccd873ac5cb19310002163120868c

ProsperCraft commented 6 years ago

I forgot to mention that this was with 1.3.4. So it isn't fixed.

Neimoh commented 6 years ago

1.3.3 works but I don't have sim / player status. 1.3.4 crashes clients trying to join and eventually crashes the server with this d-sharp error

FabioZumbi12 commented 5 years ago

People who forked SEDB fixed all know bugs, just try ;)