Fixed a crash (#6057) (#6061)

This commit is contained in:
Xander Lenstra 2022-01-27 12:33:18 +01:00 committed by GitHub
parent b121563b99
commit cd05fe6ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -298,6 +298,9 @@ class OptionsPopup(val previousScreen: BaseScreen) : Popup(previousScreen) {
if (noProblem) lines += FormattedLine("No problems found.".tr())
postCrashHandlingRunnable {
// When the options popup is already closed before this postRunnable is run,
// Don't add the labels, as otherwise the game will crash
if (stage == null) return@postCrashHandlingRunnable
// Don't just render text, since that will make all the conditionals in the mod replacement messages move to the end, which makes it unreadable
// Don't use .toLabel() either, since that activates translations as well, which is what we're trying to avoid,
// Instead, some manual work needs to be put in.