Skip to content

Commit

Permalink
Fix crash when getting discord token in certain conditions (e.g. macO…
Browse files Browse the repository at this point in the history
…S compiled version)
  • Loading branch information
laggykiller committed Aug 11, 2024
1 parent c127c38 commit 723d813
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sticker_convert/utils/chrome_remotedebug.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ def exec_js(self, js: str, context_id: Optional[int] = None):

def get_curr_url(self) -> str:
r = self.exec_js("window.location.href")
return cast(str, json.loads(r)["result"]["result"]["value"])
return cast(
str, json.loads(r).get("result", {}).get("result", {}).get("value", "")
)

def navigate(self, url: str):
command = {"id": self.cmd_id, "method": "Page.navigate", "params": {"url": url}}
Expand Down

0 comments on commit 723d813

Please sign in to comment.