Prevent crashing if getCopyrights fail.
parent
e2b6f3527e
commit
3f6abd722d
11
js/h5p.js
11
js/h5p.js
|
@ -774,7 +774,7 @@ H5P.newRunnable = function (library, contentId, $attachTo, skipResize, extras) {
|
||||||
*/
|
*/
|
||||||
H5P.error = function (err) {
|
H5P.error = function (err) {
|
||||||
if (window.console !== undefined && console.error !== undefined) {
|
if (window.console !== undefined && console.error !== undefined) {
|
||||||
console.error(err);
|
console.error(err.stack ? err.stack : err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -883,10 +883,17 @@ H5P.getCopyrights = function (instance, parameters, contentId) {
|
||||||
var copyrights;
|
var copyrights;
|
||||||
|
|
||||||
if (instance.getCopyrights !== undefined) {
|
if (instance.getCopyrights !== undefined) {
|
||||||
|
try {
|
||||||
// Use the instance's own copyright generator
|
// Use the instance's own copyright generator
|
||||||
copyrights = instance.getCopyrights();
|
copyrights = instance.getCopyrights();
|
||||||
}
|
}
|
||||||
else {
|
catch (err) {
|
||||||
|
// Failed, prevent crashing page.
|
||||||
|
H5P.error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copyrights === undefined) {
|
||||||
// Create a generic flat copyright list
|
// Create a generic flat copyright list
|
||||||
copyrights = new H5P.ContentCopyrights();
|
copyrights = new H5P.ContentCopyrights();
|
||||||
H5P.findCopyrights(copyrights, parameters, contentId);
|
H5P.findCopyrights(copyrights, parameters, contentId);
|
||||||
|
|
Loading…
Reference in New Issue