Incapamentum / Exalted-Sage

Discord bot that does API requests to retrieve a collection of daily achievements for the next day and pushes an alert when any that is in a watchlist shows up.
3 stars 0 forks source link

Unhandled Exception in UserVoiceStateUpdated Handler (System.ArgumentNullException) #15

Closed Incapamentum closed 1 year ago

Incapamentum commented 1 year ago

A System.ArgumentNullException error is being thrown in the UserVoiceStateUpdated handler, which is powered by the VoiceEventHandler class.

The error seems a bit vague, as it states that the error is being thrown on line 88, but seems it happens in the ResetVoiceChannelName() method on this line. Likely, the error is being thrown since it is attempting to rename the Meta voice channel, which is not one of the event voice channels that allow guild members to rename. In other names, since there is no "default" name associated with the VC ID, an empty reference is being returned from the database.

This should be a quick and easy fix. Image of stack trace included: VoiceEventHandler_l88

Incapamentum commented 1 year ago

The issue indeed was occurring within the ResetVoiceChannelName() method. To be more exact, when the GetChannelName() method from the ChannelHelper was invoked, it returned null for the Meta VC, as that channel is not present in the lfg-events doc.

The fix was just to check whether the VC was valid or not. A merge will be pursued soon after.