fix: Added check for null in Message constructor (#253)
Co-authored-by: Walterskirchen <walterskirchen@walter-group.com> Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
This commit is contained in:
parent
d7459eac23
commit
6c7a3f9899
1 changed files with 3 additions and 3 deletions
|
|
@ -64,7 +64,7 @@ class Message extends Base {
|
||||||
* ID for the Chat that this message was sent to, except if the message was sent by the current user.
|
* ID for the Chat that this message was sent to, except if the message was sent by the current user.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.from = typeof (data.from) === 'object' ? data.from._serialized : data.from;
|
this.from = (typeof (data.from) === 'object' && data.from !== null) ? data.from._serialized : data.from;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID for who this message is for.
|
* ID for who this message is for.
|
||||||
|
|
@ -73,13 +73,13 @@ class Message extends Base {
|
||||||
* If the message is sent by another user, it will be the ID for the current user.
|
* If the message is sent by another user, it will be the ID for the current user.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.to = typeof (data.to) === 'object' ? data.to._serialized : data.to;
|
this.to = (typeof (data.to) === 'object' && data.to !== null) ? data.to._serialized : data.to;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the message was sent to a group, this field will contain the user that sent the message.
|
* If the message was sent to a group, this field will contain the user that sent the message.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author;
|
this.author = (typeof (data.author) === 'object' && data.author !== null) ? data.author._serialized : data.author;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the message was forwarded
|
* Indicates if the message was forwarded
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue