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: Cannot set property 'endIndex' of undefined #48

Open
spro opened this issue Dec 28, 2020 · 2 comments
Open

TypeError: Cannot set property 'endIndex' of undefined #48

spro opened this issue Dec 28, 2020 · 2 comments

Comments

@spro
Copy link

spro commented Dec 28, 2020

This error occasionally crashes the server while working on an HTML file. I haven't been able to pin down exactly what causes it, but seems like a sprinkle of try/catch would be helpful in the meantime.

~/.vim/bundle/bracey.vim/server/htmlfile.js:414
		elem.endIndex = this._parser.endIndex;
		              ^

TypeError: Cannot set property 'endIndex' of undefined
    at DomHandler.handler._setEnd (~/.vim/bundle/bracey.vim/server/htmlfile.js:414:17)
    at DomHandler.onElemEnd (~/.vim/bundle/bracey.vim/server/htmlfile.js:427:8)
    at Parser.onend (~/.vim/bundle/bracey.vim/server/node_modules/htmlparser2/lib/Parser.js:337:23)
    at Tokenizer._finish (~/.vim/bundle/bracey.vim/server/node_modules/htmlparser2/lib/Tokenizer.js:890:15)
    at Tokenizer.end (~/.vim/bundle/bracey.vim/server/node_modules/htmlparser2/lib/Tokenizer.js:881:29)
    at Parser.end (~/.vim/bundle/bracey.vim/server/node_modules/htmlparser2/lib/Parser.js:367:21)
    at parse (~/.vim/bundle/bracey.vim/server/htmlfile.js:432:9)
    at HtmlFile.setContent (~/.vim/bundle/bracey.vim/server/htmlfile.js:145:22)
    at Server.handleEditorCommand (~/.vim/bundle/bracey.vim/server/server.js:116:16)
    at Server.parseEditorRequest (~/.vim/bundle/bracey.vim/server/server.js:97:7)
@turbio
Copy link
Owner

turbio commented Jan 3, 2021

Thanks for reporting, I'll take a look when I get a chance. Any chance you could include the content of the HTML file when you ran into this issue?

@spro
Copy link
Author

spro commented Jan 5, 2021

I don't have it anymore sorry, but I dug into the source and can confirm that wrapping the above statement with if(elem) fixed the issue for me.

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