Skip to content

Commit c4779ef

Browse files
Fixed exception which occurs if one of the include directories doesn't exists and we try to search it for Arduino.h
1 parent f15d0ee commit c4779ef

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)