[pmg-devel] [PATCH pmg-gui] fix MailInfo update without data

Dominik Csapak d.csapak at proxmox.com
Thu Apr 16 12:25:02 CEST 2020


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 at proxmox.com>
---
 js/MailInfo.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/js/MailInfo.js b/js/MailInfo.js
index 982ed0e..89cc78c 100644
--- a/js/MailInfo.js
+++ b/js/MailInfo.js
@@ -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));
-- 
2.20.1




More information about the pmg-devel mailing list