HFP-1905 Fix potential undefined values

pull/52/head
Oliver Tacke 2018-06-01 17:44:21 +02:00
parent 8f45ea4d79
commit 0fbc6ef5a8
1 changed files with 2 additions and 2 deletions

View File

@ -1045,10 +1045,10 @@ H5P.findCopyrights = function (info, parameters, contentId) {
var value = parameters[field]; var value = parameters[field];
if (value.library && typeof value.library === 'string') { if (value && value.library && typeof value.library === 'string') {
lastContentTypeName = value.library.split(' ')[0]; lastContentTypeName = value.library.split(' ')[0];
} }
else if (value.library && typeof value.library === 'object') { else if (value && value.library && typeof value.library === 'object') {
lastContentTypeName = (value.library.library && typeof value.library.library === 'string') ? value.library.library.split(' ')[0] : lastContentTypeName; lastContentTypeName = (value.library.library && typeof value.library.library === 'string') ? value.library.library.split(' ')[0] : lastContentTypeName;
} }