Skip to content

Commit

Permalink
Catch errors when diskNavigationRoot isn't valid
Browse files Browse the repository at this point in the history
  • Loading branch information
murilopolese committed Nov 5, 2024
1 parent f99cba5 commit 8192bbf
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions ui/arduino/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,24 +406,36 @@ async function store(state, emitter) {
emitter.emit('render')

if (state.isConnected) {
state.boardFiles = await getBoardFiles(
serial.getFullPath(
state.boardNavigationRoot,
state.boardNavigationPath,
''
try {
state.boardFiles = await getBoardFiles(
serial.getFullPath(
state.boardNavigationRoot,
state.boardNavigationPath,
''
)
)
)
} catch (e) {
state.boardFiles = []
}
} else {
state.boardFiles = []
}

state.diskFiles = await getDiskFiles(
disk.getFullPath(
state.diskNavigationRoot,
state.diskNavigationPath,
''
try {
state.diskFiles = await getDiskFiles(
disk.getFullPath(
state.diskNavigationRoot,
state.diskNavigationPath,
''
)
)
)
} catch (e) {
state.diskNavigationRoot = null
state.diskNavigationPath = '/'
state.isLoadingFiles = false
emitter.emit('render')
return
}

emitter.emit('refresh-selected-files')
state.isLoadingFiles = false
Expand Down

0 comments on commit 8192bbf

Please sign in to comment.