chore: handle undefined in writeJid

This commit is contained in:
Adhiraj Singh
2022-04-14 17:13:28 +05:30
parent e3cb822c08
commit 3a540b2b22

View File

@@ -46,8 +46,8 @@ export const encodeBinaryNode = ({ tag, attrs, content }: BinaryNode, buffer: nu
const writeJid = ({ agent, device, user, server }: ReturnType<typeof jidDecode>) => { const writeJid = ({ agent, device, user, server }: ReturnType<typeof jidDecode>) => {
if(typeof agent !== 'undefined' || typeof device !== 'undefined') { if(typeof agent !== 'undefined' || typeof device !== 'undefined') {
pushByte(TAGS.AD_JID) pushByte(TAGS.AD_JID)
pushByte(agent) pushByte(agent || 0)
pushByte(device) pushByte(device || 0)
writeString(user) writeString(user)
} else { } else {
pushByte(TAGS.JID_PAIR) pushByte(TAGS.JID_PAIR)