Be resilient to missing data in MessageReceiver constructor
This commit is contained in:
parent
bc57a31e99
commit
37aa3146bb
1 changed files with 11 additions and 9 deletions
|
@ -113,7 +113,7 @@ class MessageReceiverInner extends EventTarget {
|
||||||
|
|
||||||
count: number;
|
count: number;
|
||||||
|
|
||||||
deviceId: number;
|
deviceId?: number;
|
||||||
|
|
||||||
hasConnected?: boolean;
|
hasConnected?: boolean;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class MessageReceiverInner extends EventTarget {
|
||||||
|
|
||||||
isEmptied?: boolean;
|
isEmptied?: boolean;
|
||||||
|
|
||||||
number_id: string | null;
|
number_id?: string;
|
||||||
|
|
||||||
password: string;
|
password: string;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class MessageReceiverInner extends EventTarget {
|
||||||
|
|
||||||
uuid: string;
|
uuid: string;
|
||||||
|
|
||||||
uuid_id: string | null;
|
uuid_id?: string;
|
||||||
|
|
||||||
wsr?: WebSocketResource;
|
wsr?: WebSocketResource;
|
||||||
|
|
||||||
|
@ -176,12 +176,14 @@ class MessageReceiverInner extends EventTarget {
|
||||||
options.serverTrustRoot
|
options.serverTrustRoot
|
||||||
);
|
);
|
||||||
|
|
||||||
this.number_id = oldUsername ? utils.unencodeNumber(oldUsername)[0] : null;
|
this.number_id = oldUsername
|
||||||
this.uuid_id = username ? utils.unencodeNumber(username)[0] : null;
|
? utils.unencodeNumber(oldUsername)[0]
|
||||||
this.deviceId = parseInt(
|
: undefined;
|
||||||
utils.unencodeNumber(username || oldUsername)[1],
|
this.uuid_id = username ? utils.unencodeNumber(username)[0] : undefined;
|
||||||
10
|
this.deviceId =
|
||||||
);
|
username || oldUsername
|
||||||
|
? parseInt(utils.unencodeNumber(username || oldUsername)[1], 10)
|
||||||
|
: undefined;
|
||||||
|
|
||||||
this.incomingQueue = new PQueue({ concurrency: 1, timeout: 1000 * 60 * 2 });
|
this.incomingQueue = new PQueue({ concurrency: 1, timeout: 1000 * 60 * 2 });
|
||||||
this.pendingQueue = new PQueue({ concurrency: 1, timeout: 1000 * 60 * 2 });
|
this.pendingQueue = new PQueue({ concurrency: 1, timeout: 1000 * 60 * 2 });
|
||||||
|
|
Loading…
Reference in a new issue