Permalink
Browse files

Merge pull request #29 from flatiron/check

[fix] Check for self.chunks before operating on it
  • Loading branch information...
pksunkara committed Jun 11, 2012
2 parents a7b354e + c4df334 commit 1b649024a4d9ec9709e0927863f9cc30fe092747
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/buffered-stream.js
View
@@ -75,9 +75,11 @@ BufferedStream.prototype.pipe = function () {
}
process.nextTick(function () {
- self.chunks.forEach(function (c) { self.emit('data', c) });
- self.size = 0;
- delete self.chunks;
+ if (self.chunks) {
+ self.chunks.forEach(function (c) { self.emit('data', c) });
+ self.size = 0;
+ delete self.chunks;
+ }
if (!self.readable) {
if (self.ended) {

0 comments on commit 1b64902

Please sign in to comment.