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

Commit 194dc92

Browse files
elektronikworkshopadiazulay
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 70d323d commit 194dc92

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
@@ -141,7 +141,13 @@ async function findDirContaining(dir: string, what: string): Promise<string | un
141141
const readdir = tp.promisify(fs.readdir);
142142
const fsstat = tp.promisify(fs.stat);
143143

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

0 commit comments

Comments
 (0)