Skip to content
This repository was archived by the owner on Dec 22, 2024. It is now read-only.

Commit 636d5c2

Browse files
elektronikworkshophlovdal
authored andcommitted
Fixed exception which occurs if one of the include directories doesn't exists and we try to search it for Arduino.h
1 parent 9abfa51 commit 636d5c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/arduino/intellisense.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,13 @@ async function findDirContaining(dir: string, what: string): Promise<string | un
142142
const readdir = tp.promisify(fs.readdir);
143143
const fsstat = tp.promisify(fs.stat);
144144

145-
for (const entry of await readdir(dir)) {
145+
let entries: string[];
146+
try {
147+
entries = await readdir(dir);
148+
} catch (e) {
149+
return undefined;
150+
}
151+
for (const entry of entries) {
146152
const p = path.join(dir, entry);
147153
const s = await fsstat(p);
148154
if (s.isDirectory()) {

0 commit comments

Comments
 (0)