From a23075a32617dbb9aaf4302e57b53340b2b41155 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 18 Nov 2020 20:09:07 +0100 Subject: [PATCH] make safe to call when no attachments present --- src/matrix/room/sending/PendingEvent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/matrix/room/sending/PendingEvent.js b/src/matrix/room/sending/PendingEvent.js index 550cde8d..ad0e0566 100644 --- a/src/matrix/room/sending/PendingEvent.js +++ b/src/matrix/room/sending/PendingEvent.js @@ -85,11 +85,11 @@ export class PendingEvent { get error() { return this._error; } 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() { - 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) {