diff --git a/lib/eupmc.js b/lib/eupmc.js index b47a654..1cfda9f 100644 --- a/lib/eupmc.js +++ b/lib/eupmc.js @@ -58,6 +58,11 @@ EuPmc.prototype.completeCallback = function(data) { var resp = data.responseWrapper; + if(!resp.hitCount[0] || !resp.resultList[0].result) { + log.error("Malformed response from EuropePMC. Try running again."); + process.exit(1); + } + if (eupmc.first){ eupmc.first = false; eupmc.hitcount = parseInt(resp.hitCount[0]);