cloudStack - capability doesn't always get returned in Firewall object. Do a extra validation before loop through it.

This commit is contained in:
Jessica Wang 2011-06-01 12:05:17 -07:00
parent 9961e1ca2a
commit 80e0e7a4e6
1 changed files with 16 additions and 12 deletions

View File

@ -1221,23 +1221,27 @@ function ipJsonToDetailsTab() {
function ipFindNetworkServiceByName(pName, networkObj) {
if(networkObj == null)
return null;
for(var i=0; i<networkObj.service.length; i++) {
var networkServiceObj = networkObj.service[i];
if(networkServiceObj.name == pName)
return networkServiceObj;
}
return null;
if(networkObj.service != null) {
for(var i=0; i<networkObj.service.length; i++) {
var networkServiceObj = networkObj.service[i];
if(networkServiceObj.name == pName)
return networkServiceObj;
}
}
return null;
}
function ipFindCapabilityByName(pName, networkServiceObj) {
if(networkServiceObj == null)
return null;
for(var i=0; i<networkServiceObj.capability.length; i++) {
var capabilityObj = networkServiceObj.capability[i];
if(capabilityObj.name == pName)
return capabilityObj;
}
return null;
if(networkServiceObj.capability != null) {
for(var i=0; i<networkServiceObj.capability.length; i++) {
var capabilityObj = networkServiceObj.capability[i];
if(capabilityObj.name == pName)
return capabilityObj;
}
}
return null;
}