telegram-tl-node icon indicating copy to clipboard operation
telegram-tl-node copied to clipboard

Unconditional use of `logger.info` in `type-object.js` causes crash

Open leonerd opened this issue 8 years ago • 0 comments

In lib/type-object.js, line 256:

    this.constructor.logger.info('end > this._buffer.length', end, this._buffer.length);

causes a crash:

[ERROR] Fri, 06 Jan 2017 17:23:00 GMT  net.RpcChannel Unable to deserialize response 6cfeffff from mtproto.service.invokeWithLayer due to TypeError: Cannot read property 'info' of undefined
    at EncryptedMessage.TypeObject._readBytes (/home/leo/src/matrix/matrix-appservice-tg/node_modules/telegram.link/node_modules/telegram-tl-node/lib/type-object.js:256:32)

I have mitigated this by changing the code to

    this.constructor.logger &&
        this.constructor.logger.info('end > this._buffer.length', end, this._buffer.length);

leonerd avatar Jan 06 '17 17:01 leonerd