Skip to content

Commit

Permalink
Do not crash with an exception when editing hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Feb 19, 2020
1 parent 8117879 commit 3a675ae
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib/y2network/interface_config_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,16 @@ def save
end
end

yast_config.rename_interface(@old_name, name, renaming_mechanism) if renamed_interface?
yast_config.add_or_update_connection_config(@connection_config)
# Assign the new added interface in case of a new connection for an
# unplugged one (bsc#1162679)
interface = find_interface unless interface

if interface.respond_to?(:custom_driver)
interface.custom_driver = driver_auto? ? nil : driver.name
yast_config.add_or_update_driver(driver) unless driver_auto?
end
yast_config.rename_interface(@old_name, name, renaming_mechanism) if renamed_interface?
yast_config.add_or_update_connection_config(@connection_config)

nil
end
Expand Down Expand Up @@ -245,7 +249,7 @@ def ifplugd_priority
def driver
return @driver if @driver

if @interface.custom_driver
if @interface&.custom_driver
@driver = yast_config.drivers.find { |d| d.name == @interface.custom_driver }
end
@driver ||= :auto
Expand Down

0 comments on commit 3a675ae

Please sign in to comment.