changeset 2247:ae2bf6a1693e

Potential fix for #21
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 19 Apr 2016 11:50:08 +0100
parents 152eada7bd03
children 9c7f09d3364d 30c012132427
files js/core.js
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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));