Skip to content
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

ftl2js throws null error when message has only attributes #6

Open
tustin2121 opened this issue Apr 26, 2024 · 1 comment
Open

ftl2js throws null error when message has only attributes #6

tustin2121 opened this issue Apr 26, 2024 · 1 comment

Comments

@tustin2121
Copy link

🐛 Bug Report

The ftl2js function throws a TypeError for trying to "read properties of null" when a message has attributes but no pattern.

To Reproduce

let ftl = `
app = 
  .name = Hello
`;

let data = ftl2js(ftl);

The problem seems to be that the getTypeName function simply assumes that it will be passed a valid object and does no checks for null, and a message with no pattern parses to a null value. Having a message with no pattern but one or more attributes is valid fluent syntax.

Expected behavior

An exception is not thrown.

Your Environment

  • runtime version: Electron v30.0.1, Node v20.11.1
  • module version: fluent_conv: 3.3.0
  • os: Windows
@adrai
Copy link
Contributor

adrai commented Apr 26, 2024

Would you like to send a Pull Request to address this?

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

No branches or pull requests

2 participants