Ensure the Query Tool doesn't throw an error when viewing the contents of a table with no columns. Fixes #4492

This commit is contained in:
Yosry Muhammad
2019-08-01 14:39:02 +01:00
committed by Dave Page
parent 76e658ee12
commit 97e39699ea
2 changed files with 3 additions and 2 deletions

View File

@@ -2467,8 +2467,8 @@ define('tools.querytool', [
var explain_data_array = [],
explain_data_json = null;
if(self.colinfo[0].name == 'QUERY PLAN' && data.result
if(data.result && !_.isEmpty(self.colinfo)
&& self.colinfo[0].name == 'QUERY PLAN' && !_.isEmpty(data.types)
&& data.types[0] && data.types[0].typname === 'json') {
/* json is sent as text, parse it */
explain_data_json = JSON.parse(data.result[0][0]);