Fix crash when launcher UI fonts are installed system-wide#1337
Open
andy013 wants to merge 1 commit intoAlbeoris:mainfrom
Open
Fix crash when launcher UI fonts are installed system-wide#1337andy013 wants to merge 1 commit intoAlbeoris:mainfrom
andy013 wants to merge 1 commit intoAlbeoris:mainfrom
Conversation
Contributor
|
Hey Andy, have only recently been seeing you around here. Welcome to the community! Great to see another contributor. |
Contributor
Author
|
@WarpedEdge Thanks! You probably won't see much of me as I'm quite busy with other projects, but I try and help if I can. |
Contributor
Author
|
It might be better to disable looking for translation strings for font names. With this PR you could still run into an issue where a font has the same name as one of the translation keys and gets translated when it shouldn't be. Font names should never be translated. Feel free to close this PR if you have a better solution to this. Hopefully it still helped to identify the cause of the crash. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: #1327
If a user has any of the fonts that are shipped with the launcher installed, it will crash from the second time it is ran onwards.
Memoria/Memoria.Launcher/Resources/Fonts.xaml
Lines 1 to 6 in cf5697d
If you are trying to recreate this issue, you don't need to install these fonts. You can manually add the name of any of the above fonts to the
FontListfile.The first time the launcher is ran the
FontListfile of installed fonts doesn't exist and so the crash doesn't happen.If a user has one of the fonts installed, the next time it is ran this code at line 517 will cause the crash:
Memoria/Memoria.Launcher/Launcher/UiGrid.cs
Lines 514 to 520 in cf5697d
The above code looks to see if there is a specific language string for the combo box values. The crash happens because
Lang.Rescontains theFontFamilyobjects of the above 4 fonts. It returns a match and then crashes when cast to a string.The same problem exists in
RefereshComboBoxesalthough it currently crashes before that can ever throw an error.I'm not sure what the best way to fix this is but this is my attempt. I created a separate
ResourceDictionaryjust for all the language strings. This way, whenever you lookup a key inLang.Resyou can guarantee it's a string from one of the language files and not another type of resource.