From 47007076cc22ea56eacff41e8d70463d6c57810f Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Wed, 8 Jun 2016 12:48:34 +0100 Subject: [PATCH] Fix validation issue causing statistics tab to break if no node is selected on browser tree and user clicks on statistics tab. --- .../misc/statistics/static/js/statistics.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js index 019902b19..5278271a6 100644 --- a/web/pgadmin/misc/statistics/static/js/statistics.js +++ b/web/pgadmin/misc/statistics/static/js/statistics.js @@ -229,15 +229,17 @@ function(_, $, pgBrowser, Backgrid) { * We will wait for some time before fetching the statistics for the * selected node. **/ - if (self.timeout) { - clearTimeout(self.timeout); - } - self.timeout = setTimeout( - function() { - self.__updateCollection.call( - self, node.generate_url(item, 'stats', data, true), node - ); - }, 400); + if (node) { + if (self.timeout) { + clearTimeout(self.timeout); + } + self.timeout = setTimeout( + function() { + self.__updateCollection.call( + self, node.generate_url(item, 'stats', data, true), node + ); + }, 400); + } }, __createMultiLineStatistics: function(data) {