Skip to content

Commit

Permalink
Fix crash if NXBrew URL is invalid
Browse files Browse the repository at this point in the history
- Fix crash if NXBrew URL is invalid
  • Loading branch information
bbtufty committed Dec 30, 2024
1 parent abbf46e commit 9b43984
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.6 (Unreleased)
================

- Fix crash if NXBrew URL is invalid [#42]
- Use exact versions in pyproject [#32]
- Edit GH actions to run on main [#31]
- Made cache URL agnostic [#30]
Expand Down
26 changes: 21 additions & 5 deletions nxbrew_dl/gui/gui_nxbrew_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from functools import partial
from urllib.parse import urlparse

import requests
from PySide6.QtCore import (
Slot,
Signal,
Expand Down Expand Up @@ -211,11 +212,26 @@ def get_game_dict(self):
)
return False

self.game_dict = get_game_dict(
general_config=self.general_config,
regex_config=self.regex_config,
nxbrew_url=self.user_config["nxbrew_url"],
)
try:
_ = requests.get(self.user_config["nxbrew_url"])
except (requests.exceptions.SSLError, requests.exceptions.MissingSchema) as e:
self.logger.warning(
"Error found in NXBrew URL! Enter one that works and refresh the game list!"
)
return False

try:
self.game_dict = get_game_dict(
general_config=self.general_config,
regex_config=self.regex_config,
nxbrew_url=self.user_config["nxbrew_url"],
)
except Exception as e:
self.logger.warning(
"Error found retreiving game list, try another URL"
)
return False


def update_display(self, text):
"""When using the search bar, show/hide rows
Expand Down

0 comments on commit 9b43984

Please sign in to comment.