[pmg-devel] [PATCH pmg-gui] fix broken maillist when deleting last mail in list
Dominik Csapak
d.csapak at proxmox.com
Mon Nov 11 10:16:35 CET 2019
on deleting the last mail in the list, the selection is empty and
the access below to 'rec.data.id' breaks, leaving the maillist broken
(until the user changed the panel or reloaded)
so give rec an empty fallback object and check if there is a 'data'
property and use that, otherwise set the id to the empty string
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
js/SpamQuarantine.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js
index 7a3018b..79b0c59 100644
--- a/js/SpamQuarantine.js
+++ b/js/SpamQuarantine.js
@@ -154,9 +154,10 @@ Ext.define('PMG.SpamQuarantine', {
me.multiSelect();
return;
}
- var rec = selection[0];
- me.getViewModel().set('mailid', rec.data.id);
+ var rec = selection[0] || {};
+
+ me.getViewModel().set('mailid', rec.data ? rec.data.id : '');
me.updatePreview(me.raw || false, rec);
me.lookupReference('spaminfo').setID(rec);
},
--
2.20.1
More information about the pmg-devel
mailing list