From 739168ae05e66a510dde4698af02586e3eaf070f Mon Sep 17 00:00:00 2001 From: Henri Rosten Date: Thu, 1 Aug 2024 12:48:20 +0300 Subject: [PATCH] sbomnix/meta.py: Allow None in nixpkgs path Gracefully handle the case where the call to nixref_to_nixpkgs_path returns None Signed-off-by: Henri Rosten --- src/sbomnix/meta.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sbomnix/meta.py b/src/sbomnix/meta.py index 3e08a8b..bd47fc4 100644 --- a/src/sbomnix/meta.py +++ b/src/sbomnix/meta.py @@ -75,7 +75,9 @@ def get_nixpkgs_meta(self, nixref=None): if nixref: # Read meta from nixpkgs pinned by nixref LOG.debug("Reading nixpkgs path from nixref: %s", nixref) - nixpkgs_path = nixref_to_nixpkgs_path(nixref).as_posix() + nixpath = nixref_to_nixpkgs_path(nixref) + if nixpath: + nixpkgs_path = nixpath.as_posix() elif "NIX_PATH" in os.environ: # Read meta from nipxkgs referenced in NIX_PATH LOG.debug("Reading nixpkgs path from NIX_PATH environment")