Skip to content

Commit

Permalink
Ensure data is not a number in Buffer constructor
Browse files Browse the repository at this point in the history
Fixes #7
  • Loading branch information
mhart committed May 17, 2018
1 parent 1efe3bf commit afbc744
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stringstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ StringStream.prototype.write = function(data) {
return false
}
if (this.fromEncoding) {
if (Buffer.isBuffer(data)) data = data.toString()
if (Buffer.isBuffer(data) || typeof data === 'number') data = data.toString()
data = new Buffer(data, this.fromEncoding)
}
var string = this.decoder.write(data)
Expand Down

0 comments on commit afbc744

Please sign in to comment.