Skip to content

Fix potential issue in toHTML #95

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

Merged
merged 1 commit into from
May 23, 2023
Merged

Conversation

extremeheat
Copy link
Member

Chat message may have a translate field, but with no with field. Fixes toHTML code trying to iterate over possibly undefined field

Chat message may have a `translate` field, but with no `with` field. Fixes toHTML code trying to iterate over possibly undefined field
@u9g
Copy link
Member

u9g commented May 23, 2023

This is particularly worrying because we can't count on this.anything except for this.text, however we splice on a color string we don't know will exist earlier in the code: here, but this does fix the problem at hand.

@u9g u9g merged commit d9a5bc8 into PrismarineJS:master May 23, 2023
@extremeheat
Copy link
Member Author

If the color isn't in the cssDefaultStyles then the color pushed to cssProps will be undefined, yes. When .join(';') would be called the undefined will convert to an empty string that could appear as ;;color:rgb(200,0,0), for example. Excess semicolons are ignored in CSS so there shouldn't be any problem there.

@extremeheat extremeheat deleted the patch-1 branch May 24, 2023 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants