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

TypeError: reduce of empty array with no initial value #74

Closed
ridgeworks opened this issue Dec 12, 2017 · 6 comments
Closed

TypeError: reduce of empty array with no initial value #74

ridgeworks opened this issue Dec 12, 2017 · 6 comments

Comments

@ridgeworks
Copy link

ridgeworks commented Dec 12, 2017

TypeError: reduce of empty array with no initial value

generated using Chrome/OSX with mj3-demos-master/mj3-mml2html-global.html

with input:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mtable></mtable>
</math>

This is the simplest case but others also fail in similar way, e.g.,:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
	<mo>(</mo><mtable><mtr><mtd><mn>1</mn></mtd></mtr></mtable>
</math>

Full traceback:

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at s.computeBBox (mj3-mml2html-global.dist.js:1:192096)
    at s.e.getBBox (mj3-mml2html-global.dist.js:1:15975)
    at s.stretchChildren (mj3-mml2html-global.dist.js:1:171881)
    at new s (mj3-mml2html-global.dist.js:1:170829)
    at node.(anonymous function) (mj3-mml2html-global.dist.js:1:47178)
    at s.t.create (mj3-mml2html-global.dist.js:1:46975)
    at s.wrap (mj3-mml2html-global.dist.js:1:155364)
    at s.e.wrap (mj3-mml2html-global.dist.js:1:15509)
    at mj3-mml2html-global.dist.js:1:15163
@pkra pkra added the bug label Dec 12, 2017
@pkra
Copy link
Contributor

pkra commented Dec 12, 2017

Thanks for the report!

@ridgeworks
Copy link
Author

ridgeworks commented Dec 12, 2017 via email

@ridgeworks
Copy link
Author

Further testing on OSX shows this seems to only be a problem on Chrome (V62). Both Safari and Firefox (current versions) are fine.

@pkra
Copy link
Contributor

pkra commented Dec 13, 2017

FWIW, I saw it on both Chrome and Firefox on Linux.

@ridgeworks
Copy link
Author

Yes; my bad. It happens everywhere. I'll leave the diagnosis to the experts.

@dpvc
Copy link
Member

dpvc commented Dec 13, 2017

The issue74 branch resolves this issue.

@dpvc dpvc closed this as completed Feb 6, 2018
dpvc added a commit that referenced this issue Mar 5, 2018
Add initial value to reduce() calls to avoid problems with empty arrays. #74
@dpvc dpvc added the fixed label Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants