Merge pull request #13337 from larstobi/fix-undefined-method-size-for-nilclass-network-config-size

Fix undefined method `size' for nil:NilClass in network_defined?
This commit is contained in:
Chris Roberts 2024-01-23 12:38:19 -08:00 committed by GitHub
commit f2092af607
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -349,7 +349,8 @@ module VagrantPlugins
network_info = inspect_network(all_networks)
network_info.each do |network|
config = network["IPAM"]["Config"]
if (config.size > 0 &&
if (defined?(config.size) &&
config.size > 0 &&
config.first["Subnet"] == subnet_string)
@logger.debug("Found existing network #{network["Name"]} already configured with #{subnet_string}")
return network["Name"]