New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NREs in DiscordService. #21327
Fix NREs in DiscordService. #21327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I launch a dedicated server discord detects it. While on bleed it doesn't
b8e74df
to
8c83b15
Compare
You are correct. There's two instances going on here. One created by the mod manifest and the static one created if you use the static helper methods. A bit ugly. Streamlined to use one instance, and ensure that instance is able to deal with a null client. |
There was a reason to allow for disabling the service. #19343 Many players on slower system would benefit from it being disabled. |
The disabling logic |
8c83b15
to
0c61b54
Compare
Handle the client being null. Previously, a service could be created with a null client. This would leads to NREs when invoking the static Update methods. Now we guard against a null client.
0c61b54
to
a4bf635
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Handle the client being null. Previously, a service could be created with a null client. This would leads to NREs when invoking the static Update methods. Now we provide a static helper to get the instance created for the mod. This avoids two instances of the DiscordService being created (a static one, and an instance created in the mod manifest).
Fixes #21275