-
-
Notifications
You must be signed in to change notification settings - Fork 91
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 crash on empty map #456
Conversation
|
Nightly build for this pull request:
|
179734f
to
ca44087
Compare
After investigating this issue again, it seems this is another eight-year-old bug. Hopefully this PR fixes it. Needs to be tested. |
ca44087
to
f247455
Compare
Note: apart from an empty favorite map list, one can also trigger this crash by typing random words using the search box. As long as the map list is not full, one can right-click the background in the map list to select null as the map. |
@@ -114,6 +117,8 @@ private void LoadMultiMaps(IniFile mpMapsIni) | |||
maps.Add(map); | |||
} | |||
|
|||
_translatedMapNames["Unknown"] = "Unknown".L10N("Client:Main:UnknownMap"); |
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.
What about the game mode? I would also just leave it at "Client:Main:Unknown" so that it is shared.
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.
Currently it's covered in CnCNetLobby.cs
file:
string translatedGameMode = hg.GameMode.L10N($"INI:GameModes:{hg.GameMode}:UIName", notify: false);
I can also write an if statement here if you think "Client:Main:Unknown" is better
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.
Won't it fail to parse the game mode before that though?
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.
oh right let me think
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.
And I think it's a special case, so it needs special handling. Notification for the translation system for sure.
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.
Won't it fail to parse the game mode before that though?
hg.GameMode
is a string
e2be3eb
to
616a771
Compare
de08ac4#diff-777cb9df7b1707381d10997b31f560267ea801103b512c289c26765fa4454623R1367 8 years ago, CnCNet crash on null map was fixed, but LAN crash was left as is. |
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 aside from the changes proposed
Co-authored-by: Kerbiter <crabiter@vivaldi.net>
* Fix crash on empty map * Apply code style changes Co-authored-by: Kerbiter <crabiter@vivaldi.net> --------- Co-authored-by: Kerbiter <crabiter@vivaldi.net>
Previously, if a player does not select a map, it will either make the game room invisible (for CnCNet) or causes the client to crash (for LAN). Changing a game option when the map is deselected also causes the client to crash.
Related codes have been reworked, so that: