Skip to content

Commit

Permalink
fix: Handle empty file
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyharrison committed Sep 18, 2024
1 parent 257f7eb commit 95b4a7b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib4sbom/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def parse_file(self, filename: str) -> None:
if len(filename) > 0:
# Check path
filePath = Path(filename)
# Check path exists and valid file
if filePath.exists() and filePath.is_file():
# Check path exists, a valid file and not empty file
if filePath.exists() and filePath.is_file() and filePath.stat().st_size > 0:
# Assume that processing can proceed
invalid_file = False

Expand Down

0 comments on commit 95b4a7b

Please sign in to comment.