Avoid undefined errors

pull/6/head
Frode Petterson 2015-11-04 17:30:58 +01:00
parent 4bca7055ab
commit 7a369de7e7
1 changed files with 5 additions and 1 deletions

View File

@ -1794,7 +1794,8 @@ H5P.createTitle = function (rawTitle, maxLength) {
subContentId = 0; // Default
}
var content = H5PIntegration.contents['cid-' + contentId];
H5PIntegration.contents = H5PIntegration.contents || {};
var content = H5PIntegration.contents['cid-' + contentId] || {};
var preloadedData = content.contentUserData;
if (preloadedData && preloadedData[subContentId] && preloadedData[subContentId][dataId]) {
if (preloadedData[subContentId][dataId] === 'RESET') {
@ -1882,6 +1883,9 @@ H5P.createTitle = function (rawTitle, maxLength) {
}
var content = H5PIntegration.contents['cid-' + contentId];
if (content === undefined) {
content = H5PIntegration.contents['cid-' + contentId] = {};
}
if (!content.contentUserData) {
content.contentUserData = {};
}