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 read properties of undefined (reading 'split') - getTeam.js #821

Open
mavrick opened this issue Mar 24, 2024 · 0 comments

Comments

@mavrick
Copy link

mavrick commented Mar 24, 2024

team id: 12642
https://www.hltv.org/team/12642/rebels
node: 20.11.1
hltv: 3.5.0

\node_modules\hltv\lib\endpoints\getTeam.js:112
code: $('.team-country .flag').attrThen('src', function (x) { var _a; return (_a = x.split('/').pop()) === null || _a === void 0 ? void 0 : _a.split('.')[0]; })
^

TypeError: Cannot read properties of undefined (reading 'split')
at \node_modules\hltv\lib\endpoints\getTeam.js:112:114
at Object.attrThen (\node_modules\hltv\lib\scraper.js:39:20)
at \node_modules\hltv\lib\endpoints\getTeam.js:112:60
at step (\node_modules\hltv\lib\endpoints\getTeam.js:33:23)
at Object.next (\node_modules\hltv\lib\endpoints\getTeam.js:14:53)
at fulfilled (\node_modules\hltv\lib\endpoints\getTeam.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

potential fix:

${x}.split('/').pop()

casting x to a string or additional null check here.

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

1 participant