mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
readline: fix to not access a property on an undefined value
PR-URL: https://github.com/nodejs/node/pull/43543 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
1617a4621e
commit
e9574f3009
2 files changed
+24
No files matched your search
@@ -365,6 +365,9 @@ function* emitKeys(stream) {
|
||||
|
||||
// This runs in O(n log n).
|
||||
function commonPrefix(strings) {
|
||||
if (strings.length === 0) {
|
||||
return '';
|
||||
}
|
||||
if (strings.length === 1) {
|
||||
return strings[0];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const ArrayStream = require('../common/arraystream');
|
||||
const repl = require('repl');
|
||||
|
||||
const stream = new ArrayStream();
|
||||
const replServer = repl.start({
|
||||
input: stream,
|
||||
output: stream,
|
||||
terminal: true,
|
||||
});
|
||||
|
||||
// Editor mode
|
||||
replServer.write('.editor\n');
|
||||
|
||||
// Regression test for https://github.com/nodejs/node/issues/43528
|
||||
replServer.write('a');
|
||||
replServer.write(null, { name: 'tab' }); // Should not throw
|
||||
|
||||
replServer.close();
|
||||
Reference in new issue
Block a user