[lgwebos] fix NPE (#8995)

Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
J-N-K 2020-11-10 08:42:03 +01:00 committed by GitHub
parent 643c4059ab
commit 132f05bba5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,9 +77,10 @@ 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;
if (response != null) {
Matcher matcher = MAC_REGEX.matcher(response);
while (matcher.find()) { while (matcher.find()) {
String group = matcher.group(); String group = matcher.group();
@ -88,7 +89,7 @@ public class WakeOnLanUtility {
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 {