Describe the bug
DiscordRPC fails to process a DISPATCH event because it fails to convert a null value for premium_type to the PremiumType enum.
To Reproduce
I can only reproduce this behavior with specific users, but I believe that this issue only occurs on users without Nitro (where premium_type should be 0, but for some reason is null.
Expected behavior
DiscordRPC successfully parses the event.
Desktop (please complete the following information):
OS: Windows 11, 64-bit
Framework: .NET 6 (net6.0-windows)
Library Version: 1.0.175
Additional context
I patched DiscordRPC to add a ? operand to the PremiumType Premium field in User.cs and that resolved this issue, although this would change the DiscordRPC API spec and could impact other users.
Logs
--------------------------------
14:11:32.911 | INF [Abyssal.RichPresence] Handling Response. Cmd: Dispatch, Event: Ready
--------------------------------
14:11:32.912 | INF [Abyssal.RichPresence] Connection established with the RPC
--------------------------------
14:11:32.920 | ERR [Abyssal.RichPresence] Failed to process event! Error converting value {null} to type 'DiscordRPC.User+PremiumType'. Path 'user.premium_type'.
--------------------------------
14:11:32.921 | ERR [Abyssal.RichPresence] Data: {"cmd":"DISPATCH","data":{"v":1,"config":{"cdn_host":"cdn.discordapp.com","api_endpoint":"//ptb.discord.com/api","environment":"production"},"user":{"id":"[[removed]]","username":"[[removed]]","discriminator":"3826","avatar":"[[removed]]","avatar_decoration":null,"bot":false,"flags":160,"premium_type":null}},"evt":"READY","nonce":null}
--------------------------------
Describe the bug DiscordRPC fails to process a DISPATCH event because it fails to convert a
null
value forpremium_type
to thePremiumType
enum.To Reproduce I can only reproduce this behavior with specific users, but I believe that this issue only occurs on users without Nitro (where
premium_type
should be0
, but for some reason isnull
.Expected behavior DiscordRPC successfully parses the event.
Desktop (please complete the following information):
Additional context I patched DiscordRPC to add a
?
operand to thePremiumType Premium
field inUser.cs
and that resolved this issue, although this would change the DiscordRPC API spec and could impact other users.Logs