Fix for NPE when getting network interface name (#14603)

Signed-off-by: Mark Hilbush <mark@hilbush.com>
This commit is contained in:
Mark Hilbush
2023-03-14 17:32:03 -04:00
committed by GitHub
parent 596324635d
commit d4b68b2df4
5 changed files with 12 additions and 12 deletions

View File

@@ -1024,9 +1024,9 @@ public class BigAssFanHandler extends BaseThingHandler {
deviceIsConnected = false;
try {
ifAddress = InetAddress.getByName(ipv4Address);
NetworkInterface netIF = NetworkInterface.getByInetAddress(ifAddress);
logger.debug("Handler for {} using address {} on network interface {}", thing.getUID(), ipv4Address,
NetworkInterface.getByInetAddress(ifAddress).getName());
netIF != null ? netIF.getName() : "UNKNOWN");
} catch (UnknownHostException e) {
logger.warn("Handler for {} got UnknownHostException getting local IPv4 net interface: {}",
thing.getUID(), e.getMessage(), e);