Fix exception in ping component
The exception happens when ConnectionRequestURL is not a valid URL.
This commit is contained in:
1 parent
a40e4b863b
commit
5571ce96b4
1 file changed
+4
-2
@@ -63,9 +63,11 @@ const component: ClosureComponent = (vn): Component => {
|
||||
param = device["Device.ManagementServer.ConnectionRequestURL"];
|
||||
|
||||
let h;
|
||||
if (param && param.value) {
|
||||
try {
|
||||
const url = new URL(param.value[0]);
|
||||
h = url.hostname;
|
||||
} catch (err) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
if (host !== h) {
|
||||
@@ -77,7 +79,7 @@ const component: ClosureComponent = (vn): Component => {
|
||||
}
|
||||
}
|
||||
|
||||
return m("div", `Pinging ${host}:`);
|
||||
return m("div", host ? `Pinging ${host}:` : "");
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user