Skip to content

Commit

Permalink
(maint) ensure no nil dereference in find_in_interfaces
Browse files Browse the repository at this point in the history
This adds a simple check to ensure that `find_in_interfaces` does not
attempt to dereference a nil argument.  It resolves #2637
  • Loading branch information
jonathannewman committed Nov 13, 2023
1 parent 44c49f6 commit ed4e002
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/facter/util/resolvers/networking/primary_interface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def read_from_ip_route
end

def find_in_interfaces(interfaces)
return if interfaces.nil?

interfaces.each do |iface_name, interface|
interface[:bindings]&.each do |binding|
return iface_name unless Facter::Util::Resolvers::Networking.ignored_ip_address(binding[:address])
Expand Down

0 comments on commit ed4e002

Please sign in to comment.