]> git.proxmox.com Git - pmg-gui.git/commitdiff
fix MailInfo update without data
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 16 Apr 2020 10:25:02 +0000 (12:25 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 16 Apr 2020 12:44:58 +0000 (14:44 +0200)
e.g. when the user changes the email while having a mail selected,
it gets unselected (albeit briefly) and update will be called
with 'undefined'

this throws an error, so prevent this by always supplying an object

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
js/MailInfo.js

index 982ed0ed07d325056b2f9e2fda7a6e527a2c7f6e..89cc78cacba930ddda2e74b9b8ca1c36e931b2f1 100644 (file)
@@ -11,7 +11,7 @@ Ext.define('PMG.MailInfoBox', {
     update: function(data) {
        let me = this;
        let escaped = {};
-       for (const [key, value] of Object.entries(data)) {
+       for (const [key, value] of Object.entries(data || {})) {
            escaped[key] = Ext.util.Format.ellipsis(Ext.htmlEncode(value), 103);
        }
        me.items.each((item) => item.update(escaped));