Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {

ext.annotationVersion = '1.7.1'
ext.appcompatVersion = '1.6.1'
ext.biometricVersion = '1.1.0'
ext.cnajerabiometricVersion = '1.1.0'
ext.coreVersion = '1.12.0'
ext.credentialsVersion = '1.2.0'
ext.fragmentVersion = '1.6.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ private static void prepareWebViewSettings(Context context, WebSettings settings

private void start() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm == null) {
Log.w(TAG, "ConnectivityManager is null");
showError(R.string.no_network_error_desc);
return;
}
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected()) {
if (LastCheckinInfo.read(this).getAndroidId() == 0) {
Expand Down Expand Up @@ -346,6 +351,11 @@ private void closeWeb(boolean programmaticAuth) {
}

private void retrieveRtToken(String oAuthToken) {
if (oAuthToken == null || oAuthToken.isEmpty()) {
Log.w(TAG, "OAuth token is null or empty");
showError(R.string.auth_general_error_desc);
return;
}
new AuthRequest().fromContext(this)
.appIsGms()
.callerIsGms()
Expand All @@ -357,6 +367,11 @@ private void retrieveRtToken(String oAuthToken) {
.getResponseAsync(new HttpFormClient.Callback<AuthResponse>() {
@Override
public void onResponse(AuthResponse response) {
if (response == null || response.email == null) {
Log.w(TAG, "AuthResponse or email is null");
showError(R.string.auth_general_error_desc);
Comment on lines +370 to +372
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpFormClient.requestAsync() invokes callbacks on a new background thread. The new early-return branch calls showError(...), which updates views/title and can crash with CalledFromWrongThreadException. Wrap the UI updates in runOnUiThread(...) (and consider mirroring the existing error path by setting setNextButtonText(android.R.string.ok) and state = -2). Also, checking only response.email == null can still crash if email is empty; prefer TextUtils.isEmpty(response.email) before constructing new Account(...) (Account throws on empty name).

Suggested change
if (response == null || response.email == null) {
Log.w(TAG, "AuthResponse or email is null");
showError(R.string.auth_general_error_desc);
if (response == null || TextUtils.isEmpty(response.email)) {
Log.w(TAG, "AuthResponse is null or email is empty");
runOnUiThread(() -> {
showError(R.string.auth_general_error_desc);
setNextButtonText(android.R.string.ok);
});
state = -2;

Copilot uses AI. Check for mistakes.
return;
}
Account account = new Account(response.email, accountType);
if (isReAuth && reAuthAccount != null && reAuthAccount.name.equals(account.name)) {
accountManager.removeAccount(account, future -> saveAccount(account, response), null);
Expand Down
Loading