Skip to content

Commit

Permalink
fix: defend against certain peptalk messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkpunkd committed Nov 6, 2019
1 parent b10f7b0 commit e5e6f3b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/peptalk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class PepTalk extends EventEmitter implements PepTalkClient, PepTalkJS {
// console.log('SAF >>>', split)
if (this.leftovers) {
this.leftovers.previous = this.leftovers.previous + split[0]
this.leftovers.remaining -= Buffer.byteLength(split[0], 'utf8')
this.leftovers.remaining -= split[0] ? Buffer.byteLength(split[0], 'utf8') : 0
if (this.leftovers.remaining <= 0) {
split[0] = this.leftovers.previous
this.leftovers = null
Expand Down

0 comments on commit e5e6f3b

Please sign in to comment.