# HG changeset patch # User Nicholas Jillings # Date 1461063008 -3600 # Node ID ae2bf6a1693eca7cab1e3f5d7b0c29ca6f283d08 # Parent 152eada7bd030c0b83efe0ac93e2d5524f939274 Potential fix for #21 diff -r 152eada7bd03 -r ae2bf6a1693e js/core.js --- a/js/core.js Mon Apr 18 19:49:25 2016 +0100 +++ b/js/core.js Tue Apr 19 11:50:08 2016 +0100 @@ -192,7 +192,7 @@ document.getElementsByTagName('body')[0].appendChild(errorNode[0]); return; } - if (responseDocument == undefined) { + if (responseDocument == undefined || responseDocument.firstChild == undefined) { var msg = document.createElement("h3"); msg.textContent = "FATAL ERROR"; var span = document.createElement("span"); @@ -202,7 +202,7 @@ document.getElementsByTagName('body')[0].appendChild(span); return; } - if (responseDocument.children[0].nodeName == "waet") { + if (responseDocument.firstChild.nodeName == "waet") { // document is a specification // Perform XML schema validation @@ -238,7 +238,7 @@ // Generate the session-key storage.initialise(); - } else if (responseDocument.children[0].nodeName == "waetresult") { + } else if (responseDocument.firstChild.nodeName == "waetresult") { // document is a result projectXML = document.implementation.createDocument(null,"waet"); projectXML.children[0].appendChild(responseDocument.getElementsByTagName('waet')[0].getElementsByTagName("setup")[0].cloneNode(true));