fix: presence event when contact not exists

This commit is contained in:
Dayan C. Galiazzi
2020-09-21 01:32:02 -03:00
parent 5064ecc144
commit eac324bc1c

View File

@@ -25,7 +25,7 @@ export class WAConnection extends Base {
const jid = whatsappID(update.id)
const contact = this.contacts[jid]
if (jid.endsWith('@s.whatsapp.net')) { // if its a single chat
if (contact && jid.endsWith('@s.whatsapp.net')) { // if its a single chat
if (update.t) contact.lastSeen = +update.t
else if (update.type === Presence.unavailable && contact.lastKnownPresence !== Presence.unavailable) {
contact.lastSeen = unixTimestampSeconds()