Skip to content

Commit ff32164

Browse files
author
strongHunter
committed
fix typosquatting: Added None check before return
1 parent 8473e1f commit ff32164

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

guarddog/analyzer/metadata/npm/typosquatting.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def _get_top_packages(self) -> set:
4545
with open(top_packages_path, "w+") as f:
4646
json.dump(new_information, f, ensure_ascii=False, indent=4)
4747

48+
if top_packages_information is None:
49+
return set()
4850
return set(top_packages_information)
4951

5052
def _file_is_expired(self, path: str, days: int) -> bool:

guarddog/analyzer/metadata/pypi/typosquatting.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def _get_top_packages(self) -> set:
6161
with open(top_packages_path, "w+") as f:
6262
json.dump(new_information, f, ensure_ascii=False, indent=4)
6363

64+
if top_packages_information is None:
65+
return set()
6466
return set(map(self.get_safe_name, top_packages_information))
6567

6668
@staticmethod

0 commit comments

Comments
 (0)