CnCNet / xna-cncnet-client

XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
Other
226 stars 87 forks source link

Fix crashes caused by null PlayerExtraOptionsPanel #364

Closed SadPencil closed 1 year ago

SadPencil commented 2 years ago

In GameLobbyBase.cs:

protected PlayerExtraOptions GetPlayerExtraOptions() =>
    PlayerExtraOptionsPanel == null ? new PlayerExtraOptions() : PlayerExtraOptionsPanel.GetPlayerExtraOptions();

And in PlayerExtraOptions.cs:

public List<TeamStartMapping> TeamStartMappings { get; set; }  // this is by default null

Which causes a crash of a null pointer at PlayerExtraOptions.ToString(), where:

TeamStartMapping.ToListString(TeamStartMappings) // TeamStartMappings is null, while ToListString() crash on null

Also, in MultiplayerGameLobby.cs:

PlayerExtraOptionsPanel.SetIsHost(isHost);

PlayerExtraOptionsPanel can be null.

github-actions[bot] commented 2 years ago

Nightly build for this pull request:

SadPencil commented 1 year ago

I had to apply these same changes to my build in order to be able to run TS. Does this mean TS is currently broken? Is this specific to TS?

I encounter this problem when testing on migrating MO 336 which is an Ares build. So I think it is broken in all builds.