Skip to content

Commit

Permalink
Check null before accessing name inside domainObj while in all-domain…
Browse files Browse the repository at this point in the history
… computation.

Change-Id: I5ea3f79db79c265817ae50d3d1cf02d190c0d7c9
Closes-Bug: #1781341
  • Loading branch information
biswajit-mandal committed Jul 13, 2018
1 parent 1534c6d commit 8392a43
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions webroot/config/common/api/projectconfig.api.js
Expand Up @@ -236,7 +236,7 @@ function getAllDomainAsync (dataObj, callback)
var appData = dataObj.appData;
var request = dataObj.request;
if(dataObj.type === identity) {
var identityData = [], domainObj, domainId;
var identityData = [], domainObj, domainId, domainName;
if (('v2.0' == request.session.authApiVersion) ||
(null == request.session.authApiVersion)) {
identityData.push({uuid: defaultDomainId,
Expand All @@ -247,6 +247,13 @@ function getAllDomainAsync (dataObj, callback)
domainObj = commonUtils.getValueByJsonPath(request,
"session;last_token_used;project;domain", null, false);
domainId = commonUtils.getValueByJsonPath(domainObj, 'id', '', false);
domainName = commonUtils.getValueByJsonPath(domainObj, 'name', '',
false);
if ('' == domainId) {
logutils.logger.error("Did not find domain in last_token");
callback(null, {error: null, data: identityData});
return;
}
if(domainId === defaultDomainId) {
identityData.push({uuid: domainId, fq_name: [defaultDomainName]});
} else {
Expand All @@ -257,11 +264,11 @@ function getAllDomainAsync (dataObj, callback)
function(error, data){
if ((null != error) || (null == data)) {
logutils.logger.error(
'Domain Sync failed for ' + domainObj.name);
'Domain Sync failed for ' + domainName);
}
});
identityData.push({uuid: commonUtils.convertUUIDToString(domainId),
fq_name: [domainObj.name]})
fq_name: [domainName]})
}
callback(null, {error: null, data: identityData});
} else {
Expand Down

0 comments on commit 8392a43

Please sign in to comment.