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 <d.csapak@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-11-11 10:16:35 +01:00 committed by Thomas Lamprecht
parent 721ad44864
commit 38771d946b

View File

@ -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);
},