Skip to content

Commit 0b7a1d9

Browse files
authored
Do not panic on missing vulnerabilities file (#25081)
1 parent 9a768ac commit 0b7a1d9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/cve/generate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ func main() {
9292
fileNameRaw := filepath.Join(*dbDir, fileFmt(suffix, "json", ""))
9393
fileName := filepath.Join(*dbDir, fileFmt(suffix, "json", "gz"))
9494
metaName := filepath.Join(*dbDir, fileFmt(suffix, "meta", ""))
95+
// skip if file does not exist
96+
if _, err := os.Stat(fileNameRaw); os.IsNotExist(err) {
97+
logger.Log("msg", "Skipping metadata generation for missing file", "file", fileNameRaw)
98+
continue
99+
}
95100
err := nvdsync.CompressFile(fileNameRaw, fileName)
96101
if err != nil {
97102
panic(err)

0 commit comments

Comments
 (0)