mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
Plug a hole in the linux/unix read function (#945)
`this.buffer` is never initialized so if we close the port while reading we'll get an error. This has no tests but doesn't fail any of our current tests. With the streams rewrite this is no longer an issue and instead of testing it fully here I'd rather concentrate on a new implementation of it.
This commit is contained in:
parent
b78c888408
commit
0597034194
1 changed files with 3 additions and 0 deletions
|
|
@ -345,6 +345,9 @@ if (process.platform !== 'win32') {
|
|||
|
||||
// do not emit events if the stream is paused
|
||||
if (this.paused) {
|
||||
if (!this.buffer) {
|
||||
this.buffer = new Buffer(0);
|
||||
}
|
||||
this.buffer = Buffer.concat([this.buffer, b]);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue