ui: running chart: avoid breakage if tooltip was on deleted record

if we cleanup records and there was a "stale" tooltip on one of them
we get an access on undefined value exception here

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-07-22 10:29:05 +02:00
parent 486e7af640
commit 82e579d27c

View File

@ -62,9 +62,10 @@ Ext.define('PVE.widget.RunningChart', {
tooltip: {
trackMouse: true,
renderer: function( tooltip, record, ctx) {
var me = this.getChart();
var date = new Date(record.data.time);
var value = me.up().renderer(record.data.val);
let me = this.getChart();
if (!record || !record.data) return;
let date = new Date(record.data.time);
let value = me.up().renderer(record.data.val);
tooltip.setHtml(
me.up().title + ': ' + value + '<br />' +
Ext.Date.format(date, 'H:i:s')