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 getText() function in UIText #3689
Conversation
The getText() function was incorrectly adding a '\n' character, which leads to parsing error |
I would also request @jellysnake or @eviltak to have a look once since I don't know how multiline text works and haven't tested it out for the changes in this pr. |
if (linesOfText.length > 0) { | ||
String arrayText = String.join("\n", linesOfText); | ||
if (text.get().equals("")) { | ||
return text.get() + "\n" + arrayText; |
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.
In this case text.get()
is the empty string ""
- why are we prepending a newline here? Should it rather be:
if (text.get().equals("")) {
return arrayText;
} else {
return text.get() + "\n" + arrayText;
}
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.
My mistake, it should be !text.get().equals("")
. I will fix it.
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.
Should I just return arrayText
instead of text.get() + arrayText
? There was a discussion in original pr #3678 regarding this but resolved eventually.
Tested out a fair bit - merging! :-) Since this fixes a blocker I figure merge sooner, ask more questions later if needed. Existing saves may still cause problems even after the fix (since I guess a bad name might persist that way) but in a clean workspace I didn't see any issues colliding with new saves. |
Reverted with #3678. |
Contains
Fixes #3688
How to test
Start from a clean game with no save games. Try reproducing #3688, in both the ways stated over there. The new game should load properly now.