From d801d075f4baff7ba87e54352337f9cb30b5bcdb Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Wed, 21 Feb 2024 16:01:42 -0500 Subject: [PATCH] device: fix bug in hidpp20 get host names --- lib/logitech_receiver/hidpp20.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/logitech_receiver/hidpp20.py b/lib/logitech_receiver/hidpp20.py index 9b2d7f643d..2dc614514e 100644 --- a/lib/logitech_receiver/hidpp20.py +++ b/lib/logitech_receiver/hidpp20.py @@ -1764,11 +1764,11 @@ def get_host_names(device): else: remaining = 0 host_names[host] = (bool(status), name) - # update the current host's name if it doesn't match the system name - hostname = socket.gethostname().partition(".")[0] - if host_names[currentHost][1] != hostname: - set_host_name(device, hostname, host_names[currentHost][1]) - host_names[currentHost] = (host_names[currentHost][0], hostname) + if host_names: # update the current host's name if it doesn't match the system name + hostname = socket.gethostname().partition(".")[0] + if host_names[currentHost][1] != hostname: + set_host_name(device, hostname, host_names[currentHost][1]) + host_names[currentHost] = (host_names[currentHost][0], hostname) return host_names