LineReader.hasNextLine go to a endless loop when LineReader.buffer is empty #19
1 changed files with 2 additions and 1 deletions
|
|
@ -175,7 +175,7 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
|
||||||
var checkDir = fs.statSync(sourceDir);
|
var checkDir = fs.statSync(sourceDir);
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(newDirLocation, checkDir.mode);
|
fs.mkdirSync(newDirLocation, checkDir.mode);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//if the directory already exists, that's okay
|
//if the directory already exists, that's okay
|
||||||
if (e.code !== 'EEXIST') throw e;
|
if (e.code !== 'EEXIST') throw e;
|
||||||
}
|
}
|
||||||
|
|
@ -378,6 +378,7 @@ exports.LineReader.prototype = {
|
||||||
while(this.buffer.indexOf('\n') === -1) {
|
while(this.buffer.indexOf('\n') === -1) {
|
||||||
this.getBufferAndSetCurrentPosition(this.currentPosition);
|
this.getBufferAndSetCurrentPosition(this.currentPosition);
|
||||||
if(this.currentPosition === -1) return false;
|
if(this.currentPosition === -1) return false;
|
||||||
|
if(this.buffer.length === 0) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.buffer.indexOf("\n") > -1) return true;
|
if(this.buffer.indexOf("\n") > -1) return true;
|
||||||
|
|
|
||||||
Reference in a new issue