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

crashes on keypress #1

Open
ledbettj opened this issue Nov 21, 2013 · 4 comments
Open

crashes on keypress #1

ledbettj opened this issue Nov 21, 2013 · 4 comments
Labels

Comments

@ledbettj
Copy link

crashes on keypress for certain non-alphanumeric keys, for example .,?.

/usr/lib/node_modules/btc/libs/cli.js:125
        if (key.name == 'return') {
           ^
TypeError: Cannot read property 'name' of undefined
    at List.module.exports (/usr/lib/node_modules/btc/libs/cli.js:125:16)
    at List.EventEmitter.emit (events.js:99:17)
    at List.onkeypress (/usr/lib/node_modules/btc/node_modules/term-list/index.js:54:8)
    at ReadStream.EventEmitter.emit (events.js:126:20)
    at emitKey (/usr/lib/node_modules/btc/node_modules/term-list/node_modules/keypress/index.js:406:12)
    at ReadStream.onData (/usr/lib/node_modules/btc/node_modules/term-list/node_modules/keypress/index.js:48:14)
    at ReadStream.EventEmitter.emit (events.js:126:20)
    at TTY.onread (net.js:397:14)

Edit:

based on the keypress examples it looks like it's expected to check that key is truthy prior to checking any properties. (if (key && key.name == 'return') { ... })

@vincemtnz
Copy link

This is a bug in node-term-list. Fixing it here will still cause btc to crash, since there's a switch in the default onkeypress behaviour in node-term-list. I've reported a bug over there: tj/node-term-list#4 and submitted a pull request, which should fix the problem (once the dependency has been updated).

@ledbettj
Copy link
Author

👍

@vincemtnz
Copy link

node-term-list has been updated to 0.2.1 now, which fixes this bug.

@guo-yu
Copy link
Owner

guo-yu commented Nov 22, 2013

thank you @eyko , nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants