node-lightify icon indicating copy to clipboard operation
node-lightify copied to clipboard

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be an integer.

Open NodeGuy opened this issue 6 years ago • 0 comments

My program crashed with this error:

discover []
discover []
internal/buffer.js:47
    throw new ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value);
    ^

RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be an integer. Received 107.17241379310344
    at boundsError (internal/buffer.js:47:11)
    at Uint8Array.readUInt16LE (internal/buffer.js:132:5)
    at Object.cb (/root/node_modules/node-lightify/index.js:322:22)
    at lightify.processData (/root/node_modules/node-lightify/index.js:88:32)
    at lightify.onData (/root/node_modules/node-lightify/index.js:142:18)
    at Socket.<anonymous> (/root/node_modules/node-lightify/index.js:123:18)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)

It looks like it's related to the math in this line:

https://github.com/rainlake/node-lightify/blob/26af7a941ce61cace62b0f783ad59b8d311bf3cb/lib/index.js#L83

I don't know how to reproduce the error.

NodeGuy avatar Sep 13 '19 00:09 NodeGuy