changeset 2357:66cbd68a4ed0

Fix for #67
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Mon, 16 May 2016 15:06:34 +0100
parents dee115f3efee
children c812d5cc2dc6
files js/core.js
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Mon May 16 14:35:14 2016 +0100
+++ b/js/core.js	Mon May 16 15:06:34 2016 +0100
@@ -1044,7 +1044,9 @@
 		if (this.stateIndex == null) {
 			this.initialise();
 		}
-        storage.update();
+        if (this.stateIndex > -2) {
+            storage.update();
+        }
 		if (this.stateIndex == -2) {
             this.stateIndex++;
 			if (this.preTestSurvey != null)
@@ -2990,6 +2992,10 @@
             this.request.send();
         },
         update: function() {
+            if (this.key == null) {
+                console.log("Cannot save as key == null");
+                return;
+            }
             this.parent.root.setAttribute("state","update");
             var xmlhttp = new XMLHttpRequest();
             var returnURL = "";