Skip to content
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

NullReferenceException in DiscordService.UpdateParty #21275

Closed
LilToaster69 opened this issue Dec 25, 2023 · 3 comments · Fixed by #21327
Closed

NullReferenceException in DiscordService.UpdateParty #21275

LilToaster69 opened this issue Dec 25, 2023 · 3 comments · Fixed by #21327

Comments

@LilToaster69
Copy link

System Information

  • Operating System: Arch Linux
  • OpenRA Version: release-20231010
  • OpenRA Mod: Red Alert
  • Source: Official Arch repos

Exception log

OpenRA engine version release-20231010
OpenRA Language: en
Red Alert mod version release-20231010
Date: 2023-12-25 13:09:42Z
Operating System: Linux (X64, Unix 6.6.8.1)
Runtime Version: .NET CLR 6.0.24
Installed Language: en (Installed) en (Current) en (Current UI)
Exception of type `System.NullReferenceException`: Object reference not set to an instance of an object.
   at OpenRA.Mods.Common.DiscordService.UpdateParty(Int32 players, Int32 slots) in /build/openra/src/OpenRA/OpenRA.Mods.Common/DiscordService.cs:line 195
   at OpenRA.Mods.Common.Widgets.Logic.LobbyLogic.UpdateDiscordStatus() in /build/openra/src/OpenRA/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs:line 851
   at OpenRA.Network.UnitOrders.ProcessOrder(OrderManager orderManager, World world, Int32 clientId, Order order) in /build/openra/src/OpenRA/OpenRA.Game/Network/UnitOrders.cs:line 312
   at OpenRA.Network.OrderManager.ReceiveImmediateOrders(Int32 clientId, OrderPacket orders) in /build/openra/src/OpenRA/OpenRA.Game/Network/OrderManager.cs:line 174
   at OpenRA.Network.NetworkConnection.OpenRA.Network.IConnection.Receive(OrderManager orderManager) in /build/openra/src/OpenRA/OpenRA.Game/Network/Connection.cs:line 350
   at OpenRA.Sync.<>c__DisplayClass13_0.<RunUnsynced>b__0() in /build/openra/src/OpenRA/OpenRA.Game/Sync.cs:line 167
   at OpenRA.Sync.RunUnsynced(World world, Action fn) in /build/openra/src/OpenRA/OpenRA.Game/Sync.cs:line 168
   at OpenRA.Game.InnerLogicTick(OrderManager orderManager) in /build/openra/src/OpenRA/OpenRA.Game/Game.cs:line 631
   at OpenRA.Game.LogicTick() in /build/openra/src/OpenRA/OpenRA.Game/Game.cs:line 646
   at OpenRA.Game.Loop() in /build/openra/src/OpenRA/OpenRA.Game/Game.cs:line 815
   at OpenRA.Game.Run() in /build/openra/src/OpenRA/OpenRA.Game/Game.cs:line 868
   at OpenRA.Game.InitializeAndRun(String[] args) in /build/openra/src/OpenRA/OpenRA.Game/Game.cs:line 306
   at OpenRA.Launcher.Program.Main(String[] args) in /build/openra/src/OpenRA/OpenRA.Launcher/Program.cs:line 32
@anvilvapre
Copy link
Contributor

quick work around could be to disable the discord service. or to not run discord on your host.

i.e. in settings.yaml

Game:
        Mod: ra
        EnableDiscordService: False

@Mailaender Mailaender changed the title My game crashed NullReferenceException in DiscordService.UpdateParty Jan 28, 2024
@Mailaender
Copy link
Member

Do you have Discord installed?

@RoosterDragon
Copy link
Member

Theorizing: DiscordService.Service has a guard to return null if EnableDiscordService is false. Lots of stuff checks for a null Service to skip logic. But if Game.Renderer == null then Service/instance is created, but client is null.

Then in UpdateParty it could be dying on the null client?

static DiscordService Service
{
get
{
if (instance != null)
return instance;
if (!Game.Settings.Game.EnableDiscordService)
return null;
if (!Game.ModData.Manifest.Contains<DiscordService>())
return null;
instance = Game.ModData.Manifest.Get<DiscordService>();
return instance;
}
}
public DiscordService(MiniYaml yaml)
{
FieldLoader.Load(this, yaml);
if (!Game.Settings.Game.EnableDiscordService)
return;
// HACK: Prevent service from starting when launching the utility or server.
if (Game.Renderer == null)
return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants