mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 23:22:02 +01:00
[samsungtv] fix NPE (#8991)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
parent
afe711994a
commit
643c4059ab
@ -77,18 +77,19 @@ public class WakeOnLanUtility {
|
|||||||
|
|
||||||
String[] cmds = Stream.of(COMMAND.split(" ")).map(arg -> String.format(arg, hostName)).toArray(String[]::new);
|
String[] cmds = Stream.of(COMMAND.split(" ")).map(arg -> String.format(arg, hostName)).toArray(String[]::new);
|
||||||
String response = ExecUtil.executeCommandLineAndWaitResponse(Duration.ofMillis(CMD_TIMEOUT_MS), cmds);
|
String response = ExecUtil.executeCommandLineAndWaitResponse(Duration.ofMillis(CMD_TIMEOUT_MS), cmds);
|
||||||
Matcher matcher = MAC_REGEX.matcher(response);
|
|
||||||
String macAddress = null;
|
String macAddress = null;
|
||||||
|
|
||||||
while (matcher.find()) {
|
if (response != null) {
|
||||||
String group = matcher.group();
|
Matcher matcher = MAC_REGEX.matcher(response);
|
||||||
|
while (matcher.find()) {
|
||||||
|
String group = matcher.group();
|
||||||
|
|
||||||
if (group.length() == 17) {
|
if (group.length() == 17) {
|
||||||
macAddress = group;
|
macAddress = group;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (macAddress != null) {
|
if (macAddress != null) {
|
||||||
LOGGER.debug("MAC address of host {} is {}", hostName, macAddress);
|
LOGGER.debug("MAC address of host {} is {}", hostName, macAddress);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user