mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 06:33:55 -06:00
Only call failed_callback if provided
Otherwise we'd crash because NoneType can't be called. Contributes to issue CURA-8539.
This commit is contained in:
parent
f0cbdeb903
commit
c36863da56
1 changed files with 6 additions and 3 deletions
|
@ -132,12 +132,14 @@ class AuthorizationHelpers:
|
|||
"""
|
||||
if reply.error() != QNetworkReply.NetworkError.NoError:
|
||||
Logger.warning(f"Could not access account information. QNetworkError {reply.errorString()}")
|
||||
if failed_callback is not None:
|
||||
failed_callback()
|
||||
return
|
||||
|
||||
profile_data = HttpRequestManager.getInstance().readJSON(reply)
|
||||
if profile_data is None or "data" not in profile_data:
|
||||
Logger.warning("Could not parse user data from token.")
|
||||
if failed_callback is not None:
|
||||
failed_callback()
|
||||
return
|
||||
profile_data = profile_data["data"]
|
||||
|
@ -145,6 +147,7 @@ class AuthorizationHelpers:
|
|||
required_fields = {"user_id", "username"}
|
||||
if "user_id" not in profile_data or "username" not in profile_data:
|
||||
Logger.warning(f"User data missing required field(s): {required_fields - set(profile_data.keys())}")
|
||||
if failed_callback is not None:
|
||||
failed_callback()
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue