New-Project-Final-Final-WIP / HeadlessTweaks

A ResoniteModLoader mod for Resonite. Adds some nice to have features to headless clients
MIT License
14 stars 3 forks source link

Fatal exception when sending user leave notifications to webhook #8

Closed Raemien closed 1 year ago

Raemien commented 1 year ago

Explanation

I am experiencing a consistent issue where the Discord webhook integration causes my headless client to forcefully exit with a NullReferenceException when any user disconnects from the world. Embeds for join events, startup and shutdown messages appear to work fine.

If anyone else is able to reproduce this issue, I'd love to hear it.

Log snippet

10:16:39 PM.241 Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at HeadlessTweaks.DiscordIntegration.DiscordHelper.<SendUserEmbed>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

My configuration

{
  "version": "1.0.0",
  "values": {
    "UseDiscordWebhook": true,
    "DiscordWebhookID": "REDACTED",
    "DiscordWebhookKey": "REDACTED",
    "DiscordWebhookUsername": "Resonite Headless",
    "DiscordWebhookAvatar": null,
    "AutoInviteOptOut": [],
    "PermissionLevels": {},
    "WorldRoster": {},
    "SessionIdToName": {},
    "DefaultSessionAccessLevel": "FriendsOfFriends",
    "DefaultSessionHidden": true,
    "AlternateListAlpha": 0.4,
    "SmartAutosave": false,
    "_configSaved": true
  }
}