mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Fix style; undefined reference bug
This commit is contained in:
1 parent
ccf4afa256
commit
0e501f4ec5
1 file changed
+8
-6
@@ -611,6 +611,8 @@ fs.createReadStream = function(path, options) {
|
||||
var ReadStream = fs.ReadStream = function(path, options) {
|
||||
events.EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
|
||||
this.path = path;
|
||||
this.fd = null;
|
||||
this.readable = true;
|
||||
@@ -629,11 +631,12 @@ var ReadStream = fs.ReadStream = function(path, options) {
|
||||
this[key] = options[key];
|
||||
}
|
||||
|
||||
if(this.start || this.end) {
|
||||
if(this.start === undefined || this.end === undefined) {
|
||||
self.emit('error', new Error('Both start and end are needed for range streaming.'));
|
||||
} else if(this.start > this.end) {
|
||||
self.emit('error', new Error('start must be <= end'));
|
||||
if (this.start || this.end) {
|
||||
if (this.start === undefined || this.end === undefined) {
|
||||
this.emit('error',
|
||||
new Error('Both start and end are needed for range streaming.'));
|
||||
} else if (this.start > this.end) {
|
||||
this.emit('error', new Error('start must be <= end'));
|
||||
} else {
|
||||
this.firstRead = true;
|
||||
}
|
||||
@@ -643,7 +646,6 @@ var ReadStream = fs.ReadStream = function(path, options) {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
||||
if (err) {
|
||||
self.emit('error', err);
|
||||
|
||||
Reference in new issue
Block a user