Skip to content

Commit 8e0846c

Browse files
committed
Check TRAP directory exists first
1 parent 9552903 commit 8e0846c

3 files changed

Lines changed: 27 additions & 23 deletions

File tree

lib/analyze-action.js

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze-action.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze-action.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,21 @@ function hasBadExpectErrorInput(): boolean {
108108
function doesGoExtractionOutputExist(config: Config): boolean {
109109
const golangDbDirectory = util.getCodeQLDatabasePath(config, Language.go);
110110
const trapDirectory = path.join(golangDbDirectory, "trap", Language.go);
111-
return fs
112-
.readdirSync(trapDirectory)
113-
.some((fileName) =>
114-
[
115-
".trap",
116-
".trap.gz",
117-
".trap.br",
118-
".trap.tar.gz",
119-
".trap.tar.br",
120-
".trap.tar",
121-
].some((ext) => fileName.endsWith(ext))
122-
);
111+
return (
112+
fs.existsSync(trapDirectory) &&
113+
fs
114+
.readdirSync(trapDirectory)
115+
.some((fileName) =>
116+
[
117+
".trap",
118+
".trap.gz",
119+
".trap.br",
120+
".trap.tar.gz",
121+
".trap.tar.br",
122+
".trap.tar",
123+
].some((ext) => fileName.endsWith(ext))
124+
)
125+
);
123126
}
124127

125128
/**

0 commit comments

Comments
 (0)