diff core.js @ 804:0f7b9ac48364

Fix Bug #1500: Error caused by buffer not being loaded into the pool and then not linking once downloaded.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 18 Dec 2015 17:50:14 +0000
parents 947ef5412d22
children e7ea0686b094
line wrap: on
line diff
--- a/core.js	Fri Dec 18 17:27:52 2015 +0000
+++ b/core.js	Fri Dec 18 17:50:14 2015 +0000
@@ -1932,12 +1932,14 @@
 				this.commentBoxPrefix = "Comment on track";
 			}
 			var audioElementsDOM = xml.getElementsByTagName('audioElements');
+			var outsideReferenceHolder = null;
 			for (var i=0; i<audioElementsDOM.length; i++) {
 				var node = new this.audioElementNode();
 				node.decode(this,audioElementsDOM[i]);
 				if (audioElementsDOM[i].getAttribute('type') == 'outsidereference') {
 					if (this.outsideReference == null) {
-						this.outsideReference = node;
+						outsideReferenceHolder = node;
+						this.outsideReference = i;
 					} else {
 						console.log('Error only one audioelement can be of type outsidereference per audioholder');
 						this.audioElements.push(node);
@@ -1952,6 +1954,12 @@
 			{
 				this.audioElements = randomiseOrder(this.audioElements);
 			}
+			if (outsideReferenceHolder != null)
+			{
+				this.audioElements.push(outsideReferenceHolder);
+				this.outsideReference = this.audioElements.length-1;
+			}
+			
 			
 			var commentQuestionsDOM = xml.getElementsByTagName('CommentQuestion');
 			for (var i=0; i<commentQuestionsDOM.length; i++) {