Skip to content

Commit

Permalink
Fix crash when text attr is not avialable in SHOW_TOTAL_CODE_TIME
Browse files Browse the repository at this point in the history
  • Loading branch information
anduong96 committed Nov 21, 2023
1 parent 02827d6 commit cf8510c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sources/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ async def get_stats() -> str:

if EM.SHOW_TOTAL_CODE_TIME:
DBM.i("Adding total code time info...")
data = await DM.get_remote_json("waka_all")
stats += f"![Code Time](http://img.shields.io/badge/{quote('Code Time')}-{quote(str(data['data']['text']))}-blue)\n\n"
code_time = data["data"]["text"] if hasattr(data["data"], "text") else data["message"]

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable Error

Local variable 'data' may be used before it is initialized.
stats += f"![Code Time](http://img.shields.io/badge/{quote('Code Time')}-{quote(str(code_time))}-blue)\n\n"

if EM.SHOW_PROFILE_VIEWS:
DBM.i("Adding profile views info...")
Expand Down

0 comments on commit cf8510c

Please sign in to comment.