Repository: cloudstack
Updated Branches:
  refs/heads/4.7 c13c5540b -> 4dabd1311


Nullpointer Exception in NicProfileHelperImpl


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/78fbaf7d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/78fbaf7d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/78fbaf7d

Branch: refs/heads/4.7
Commit: 78fbaf7d4da995c0cdb0ae84606e66f72c6cf289
Parents: 3ee53d3
Author: Boris Schrijver <[email protected]>
Authored: Mon Jan 11 09:57:35 2016 +0100
Committer: Boris Schrijver <[email protected]>
Committed: Mon Jan 11 09:57:35 2016 +0100

----------------------------------------------------------------------
 server/src/com/cloud/network/router/NicProfileHelperImpl.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78fbaf7d/server/src/com/cloud/network/router/NicProfileHelperImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/NicProfileHelperImpl.java 
b/server/src/com/cloud/network/router/NicProfileHelperImpl.java
index 7d8c19a..4a0faa9 100644
--- a/server/src/com/cloud/network/router/NicProfileHelperImpl.java
+++ b/server/src/com/cloud/network/router/NicProfileHelperImpl.java
@@ -63,6 +63,7 @@ public class NicProfileHelperImpl implements NicProfileHelper 
{
     @DB
     public NicProfile createPrivateNicProfileForGateway(final VpcGateway 
privateGateway, final VirtualRouter router) {
         final Network privateNetwork = 
_networkModel.getNetwork(privateGateway.getNetworkId());
+
         PrivateIpVO ipVO = 
_privateIpDao.allocateIpAddress(privateNetwork.getDataCenterId(), 
privateNetwork.getId(), privateGateway.getIp4Address());
 
         final Long vpcId = privateGateway.getVpcId();
@@ -71,7 +72,11 @@ public class NicProfileHelperImpl implements 
NicProfileHelper {
             ipVO = _privateIpDao.findByIpAndVpcId(vpcId, 
privateGateway.getIp4Address());
         }
 
-        final Nic privateNic = 
_nicDao.findByIp4AddressAndNetworkId(ipVO.getIpAddress(), 
privateNetwork.getId());
+        Nic privateNic = null;
+
+        if (ipVO != null) {
+            privateNic = 
_nicDao.findByIp4AddressAndNetworkId(ipVO.getIpAddress(), 
privateNetwork.getId());
+        }
 
         NicProfile privateNicProfile = new NicProfile();
 

Reply via email to