Skip to content

Commit

Permalink
Merge pull request #12587 from nextcloud/fixAuthNPE
Browse files Browse the repository at this point in the history
On branded clients NPE can occur
  • Loading branch information
tobiasKaminsky authored Feb 23, 2024
2 parents 5a6213d + 6513234 commit 639a7b9
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.view.KeyEvent;
Expand Down Expand Up @@ -215,7 +214,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private AccountManager mAccountMgr;

/// Server PRE-Fragment elements
private AccountSetupBinding accountSetupBinding;
private AccountSetupBinding accountSetupBinding = null;
private AccountSetupWebviewBinding accountSetupWebviewBinding;

private String mServerStatusText = EMPTY_STRING;
Expand Down Expand Up @@ -768,13 +767,14 @@ protected void onDestroy() {
}


@SuppressFBWarnings("NP")
private void checkOcServer() {
String uri;
Editable hostUrlInput = accountSetupBinding.hostUrlInput.getText();

if (accountSetupBinding != null && hostUrlInput != null &&
!hostUrlInput.toString().isEmpty()) {
uri = hostUrlInput.toString().trim();
if (accountSetupBinding != null &&
accountSetupBinding.hostUrlInput.getText() != null &&
!accountSetupBinding.hostUrlInput.getText().toString().isEmpty()) {
uri = accountSetupBinding.hostUrlInput.getText().toString().trim();
} else {
uri = mServerInfo.mBaseUrl;
}
Expand Down

0 comments on commit 639a7b9

Please sign in to comment.