[pve-devel] [PATCH v2 manager 1/5] ui: avoid errors when 'template' property is not present in guest status

Fabian Ebner f.ebner at proxmox.com
Thu Mar 11 11:26:46 CET 2021


The API doesn't advertise the property as non-optional and it's safer and more
in line with the surrounding code.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

New in v2.

Needed for the next two patches to work.

 www/manager6/lxc/Config.js  | 2 +-
 www/manager6/qemu/Config.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js
index 89747a0a..73e34614 100644
--- a/www/manager6/lxc/Config.js
+++ b/www/manager6/lxc/Config.js
@@ -347,7 +347,7 @@ Ext.define('PVE.lxc.Config', {
 		var rec = s.data.get('status');
 		status = rec ? rec.data.value : 'unknown';
 		rec = s.data.get('template');
-		template = rec.data.value || false;
+		template = rec ? rec.data.value : false;
 		rec = s.data.get('lock');
 		lock = rec ? rec.data.value : undefined;
 	    }
diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js
index c0c6552c..10bf10a4 100644
--- a/www/manager6/qemu/Config.js
+++ b/www/manager6/qemu/Config.js
@@ -385,7 +385,7 @@ Ext.define('PVE.qemu.Config', {
 		rec = s.data.get('qmpstatus');
 		qmpstatus = rec ? rec.data.value : 'unknown';
 		rec = s.data.get('template');
-		template = rec.data.value || false;
+		template = rec ? rec.data.value : false;
 		rec = s.data.get('lock');
 		lock = rec ? rec.data.value : undefined;
 
-- 
2.20.1






More information about the pve-devel mailing list