Prevent crashing editor for old libraries

pull/10/head wp-1.5.5
Frode Petterson 2015-12-10 14:49:30 +01:00
parent b85ee0bd0b
commit 2bc4dee85a
1 changed files with 3 additions and 2 deletions

View File

@ -95,7 +95,8 @@ H5P.EventDispatcher.prototype.triggerXAPIScored = function (score, maxScore, ver
H5P.EventDispatcher.prototype.setActivityStarted = function() {
if (this.activityStartTime === undefined) {
// Don't trigger xAPI events in the editor
if (H5PIntegration.contents['cid-' + this.contentId] !== undefined) {
if (H5PIntegration.contents !== undefined &&
H5PIntegration.contents['cid-' + this.contentId] !== undefined) {
this.triggerXAPI('attempted');
}
this.activityStartTime = Date.now();