From 38771d946bd08e5df0aa3742078b5613ce34d9fb Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 11 Nov 2019 10:16:35 +0100 Subject: [PATCH] fix broken maillist when deleting last mail in list 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 Tested-By: Stoiko Ivanov Reviewed-By: Stoiko Ivanov --- 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); },