Skip to content

TypeError: Cannot use 'in' operator to search for 'result' in undefined #200

Open
@Aldarone

Description

@Aldarone

What version of this package are you using?

webtorrent-cli 4.0.0, webtorrent 1.5.6

What operating system, Node.js, and npm version?

ArchLinux, node v17.0.1, npm v8.1.0

What happened?

Started a movie using webtorrent --xbmc "MAGNETLINK", the movie starts on the media player (It's a RPi running Kodi) but after one or two minutes webtorrent crashes with the following error message :

UNEXPECTED ERROR: If this is a bug in WebTorrent, report it!
OPEN AN ISSUE: https://github.com/webtorrent/webtorrent-cli/issues

DEBUG INFO: webtorrent-cli 4.0.0, webtorrent 1.5.6, node v17.0.1, linux x64, exit 1
/home/user/.nvm/versions/node/v17.0.1/lib/node_modules/webtorrent-cli/node_modules/nodebmc/device.js:41
            if( !('result' in result) && result.result !== 'ok' ) {
                           ^

TypeError: Cannot use 'in' operator to search for 'result' in undefined
    at IncomingMessage.<anonymous> (/home/user/.nvm/versions/node/v17.0.1/lib/node_modules/webtorrent-cli/node_modules/nodebmc/device.js:41:28)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1340:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Node.js v17.0.1

What did you expect to happen?

Webtorrent not to crash

Are you willing to submit a pull request to fix this bug?

I don't know JS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions