Fix undefined method `size' for nil:NilClass in network_defined?

This commit is contained in:
Lars Tobias Skjong-Børsting 2024-01-20 12:59:47 +01:00
parent d5a28aea95
commit 7d8b5e45fc

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"]