From 7860fc347b9f80135cd0b8c21026fba2a0107872 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 9 May 2018 16:43:59 +0000 Subject: [PATCH] ref 11746: NLP Hub with empty output https://support.d4science.org/issues/11746 Fixed error when algorithm result is undefined git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/nlphub@167385 82a268e6-3cf1-43bd-a215-b396298e98cf --- src/main/webapp/js/main.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/js/main.js b/src/main/webapp/js/main.js index 43b7569..cca2212 100644 --- a/src/main/webapp/js/main.js +++ b/src/main/webapp/js/main.js @@ -780,7 +780,8 @@ buildAlgortihmList = function() { $("#algorithm-params-div").empty(); for (var i = 0; i < jsonContent.output.result.length; i++) { - if (jsonContent.output.result[i] === undefined) { + if (typeof jsonContent.output.result[i] === 'undefined' + || jsonContent.output.result[i] == null) { console.log("No result for " + i); } else { var cb = "
0) - return true; + if (typeof jsonContent.output.result[i] === 'undefined' + || jsonContent.output.result[i] == null) { + console.log("No result for " + i); + } else { + var entities = jsonContent.output.result[i].entities; + for (var j = 0; j < entities.length; j++) { + a = entities[j][annotation]; + if (typeof a != 'undefined') { + if (a.length > 0) + return true; + } } } }