CLOUDSTACK-6672: [Automation] NPE observed while listing system vms

fixing NPE
This commit is contained in:
Murali Reddy 2014-05-19 10:30:21 +05:30
parent 3448ab7f1c
commit 8bcd2546ac
1 changed files with 1 additions and 1 deletions

View File

@ -1209,8 +1209,8 @@ public class ApiResponseHelper implements ResponseGenerator {
NetworkOffering networkOffering = ApiDBUtils.findNetworkOfferingById(network.getNetworkOfferingId());
if (networkOffering.getElasticIp()) {
IpAddress ip = ApiDBUtils.findIpByAssociatedVmId(vm.getId());
Vlan vlan = ApiDBUtils.findVlanById(ip.getVlanId());
if (ip != null) {
Vlan vlan = ApiDBUtils.findVlanById(ip.getVlanId());
vmResponse.setPublicIp(ip.getAddress().addr());
vmResponse.setPublicNetmask(vlan.getVlanNetmask());
vmResponse.setGateway(vlan.getVlanGateway());