From e1ae4b43bedefc7fc9810e8ef6dccf120e01c783 Mon Sep 17 00:00:00 2001 From: Carmen Bianca BAKKER Date: Thu, 10 Oct 2024 17:07:23 +0200 Subject: [PATCH] Small fix to if-statement Ran across this while debugging something else. Fixing this en passant. Signed-off-by: Carmen Bianca BAKKER --- src/reuse/download.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/reuse/download.py b/src/reuse/download.py index 0901da70c..06ef1c944 100644 --- a/src/reuse/download.py +++ b/src/reuse/download.py @@ -11,7 +11,7 @@ import shutil import urllib.request from pathlib import Path -from typing import Optional, cast +from typing import Optional from urllib.error import URLError from urllib.parse import urljoin @@ -53,8 +53,10 @@ def download_license(spdx_identifier: str) -> str: def _path_to_license_file(spdx_identifier: str, project: Project) -> Path: root: Optional[Path] = project.root # Hack - if cast(Path, root).name == "LICENSES" and isinstance( - project.vcs_strategy, VCSStrategyNone + if ( + root + and root.name == "LICENSES" + and isinstance(project.vcs_strategy, VCSStrategyNone) ): root = None