fixed serial modal crash (#2278)

This commit is contained in:
Eugene Pankov 2020-03-30 11:00:48 +02:00
parent 09d55979ce
commit 045cc0d243

View file

@ -64,9 +64,10 @@ export class SerialService {
async showConnectionSelector (): Promise<void> {
const options: SelectorOption<void>[] = []
const lastConnection = JSON.parse(window.localStorage.lastSerialConnection)
const foundPorts = await this.listPorts()
try {
const lastConnection = JSON.parse(window.localStorage.lastSerialConnection)
if (lastConnection) {
options.push({
name: lastConnection.name,
@ -81,6 +82,7 @@ export class SerialService {
},
})
}
} catch { }
for (const port of foundPorts) {
options.push({