Skip to content

Commit

Permalink
fix(saucenao): 当 _get_title 在遇到获取到 None 时返回空字符串
Browse files Browse the repository at this point in the history
  • Loading branch information
NekoAria committed Jul 31, 2022
1 parent 2a3d0b2 commit 81a83dc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions PicImageSearch/model/saucenao.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def __init__(self, data: Dict[str, Any]):
self.member_id: int = result_data.get("member_id", 0)

@staticmethod
def _get_title(data: Dict[str, Any]) -> Union[str, Any]:
return next(
def _get_title(data: Dict[str, Any]) -> str:
title = next(
(
data[i]
for i in [
Expand All @@ -34,6 +34,9 @@ def _get_title(data: Dict[str, Any]) -> Union[str, Any]:
),
"",
)
if title is None:
title = ""
return title

@staticmethod
def _get_url(data: Dict[str, Any]) -> Union[str, Any]:
Expand Down

0 comments on commit 81a83dc

Please sign in to comment.