Browse Source

Merge pull request #1314 from alindeman/bridge-conflict-panic

Avoids panic when checking for conflicts against an uninitalized network
Alessandro Boch 9 years ago
parent
commit
10aec4d8f0
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libnetwork/drivers/bridge/bridge.go

+ 1 - 1
libnetwork/drivers/bridge/bridge.go

@@ -330,7 +330,7 @@ func (c *networkConfiguration) conflictsWithNetworks(id string, others []*bridge
 		// bridges. This could not be completely caught by the config conflict
 		// check, because networks which config does not specify the AddressIPv4
 		// get their address and subnet selected by the driver (see electBridgeIPv4())
-		if c.AddressIPv4 != nil {
+		if c.AddressIPv4 != nil && nwBridge.bridgeIPv4 != nil {
 			if nwBridge.bridgeIPv4.Contains(c.AddressIPv4.IP) ||
 				c.AddressIPv4.Contains(nwBridge.bridgeIPv4.IP) {
 				return types.ForbiddenErrorf("conflicts with network %s (%s) by ip network", nwID, nwConfig.BridgeName)