Skip to content

Commit

Permalink
Addon Manager: Add try/except to integer conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
chennes committed Nov 8, 2022
1 parent 5917702 commit d1ad3b4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Mod/AddonManager/NetworkManager.py
Expand Up @@ -240,7 +240,17 @@ def __init__(self):
) # This may still be QNetworkProxy.NoProxy
elif userProxyCheck:
host, _, port_string = proxy_string.rpartition(":")
port = 0 if not port_string else int(port_string)
try:
port = 0 if not port_string else int(port_string)
except ValueError:
FreeCAD.Console.PrintError(
translate(
"AddonsInstaller",
"Failed to convert the specified proxy port '{}' to a port number",
).format(port_string)
+ "\n"
)
port = 0
# For now assume an HttpProxy, but eventually this should be a parameter
proxy = QtNetwork.QNetworkProxy(
QtNetwork.QNetworkProxy.HttpProxy, host, port
Expand Down

0 comments on commit d1ad3b4

Please sign in to comment.