make safe to call when no attachments present

This commit is contained in:
Bruno Windels 2020-11-18 20:09:07 +01:00
parent fba5877b3b
commit a23075a326

View file

@ -85,11 +85,11 @@ export class PendingEvent {
get error() { return this._error; } get error() { return this._error; }
get attachmentsTotalBytes() { get attachmentsTotalBytes() {
return Object.values(this._attachments).reduce((t, a) => t + a.size, 0); return this._attachments && Object.values(this._attachments).reduce((t, a) => t + a.size, 0);
} }
get attachmentsSentBytes() { get attachmentsSentBytes() {
return Object.values(this._attachments).reduce((t, a) => t + a.sentBytes, 0); return this._attachments && Object.values(this._attachments).reduce((t, a) => t + a.sentBytes, 0);
} }
async uploadAttachments(hsApi) { async uploadAttachments(hsApi) {