From 44c1fa7138daf41c08f9c823659496af19025aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 8 Dec 2016 10:11:24 +0100 Subject: [PATCH] [FIX] web: prevent crash in line chart with 1 record Since commit 86252428846607cd5f4b18c, the graph view crashed when displaying a line chart with only one record. The reason is that the method display_line can return undefined (if no line chart can be displayed). In that case, there is no reasy to try to display its tooltip. This commit simply protect against the case where it is undefined. --- addons/web/static/src/js/views/graph_widget.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/graph_widget.js b/addons/web/static/src/js/views/graph_widget.js index b2cd726c95c..6b9e8459b78 100644 --- a/addons/web/static/src/js/views/graph_widget.js +++ b/addons/web/static/src/js/views/graph_widget.js @@ -99,7 +99,9 @@ return Widget.extend({ })); } else { var chart = this['display_' + this.mode](); - chart.tooltip.chartContainer(this.$el[0]); + if (chart) { + chart.tooltip.chartContainer(this.$el[0]); + } } }, display_bar: function () {