Skip to content

Commit fa91b09

Browse files
committed
Fix NPE and comments
1 parent 61d1963 commit fa91b09

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

app/src/main/java/fr/free/nrw/commons/auth/LoginActivity.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,25 @@ protected void onPostExecute(String result) {
7575
boolean accountCreated = AccountManager.get(context).addAccountExplicitly(account, password, null);
7676

7777
Bundle extras = context.getIntent().getExtras();
78+
79+
7880
if (extras != null) {
81+
Log.d("LoginActivity", "Bundle of extras: " + extras.toString());
7982
if (accountCreated) { // Pass the new account back to the account manager
8083
AccountAuthenticatorResponse response = extras.getParcelable(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);
8184
Bundle authResult = new Bundle();
8285
authResult.putString(AccountManager.KEY_ACCOUNT_NAME, username);
8386
authResult.putString(AccountManager.KEY_ACCOUNT_TYPE, WikiAccountAuthenticator.COMMONS_ACCOUNT_TYPE);
84-
//FIXME: NPE here sometimes, otherwise goes to Signup screen upon successful login...
85-
response.onResult(authResult);
87+
88+
if (response != null) {
89+
response.onResult(authResult);
90+
}
8691
}
8792
}
8893
// FIXME: If the user turns it off, it shouldn't be auto turned back on
8994
ContentResolver.setSyncAutomatically(account, ContributionsContentProvider.AUTHORITY, true); // Enable sync by default!
9095
ContentResolver.setSyncAutomatically(account, ModificationsContentProvider.AUTHORITY, true); // Enable sync by default!
96+
//FIXME: This is taking users back to SignupActivity
9197
context.finish();
9298
} else {
9399
int response;

app/src/main/java/fr/free/nrw/commons/auth/SignupActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
5959
}
6060
}
6161

62+
/*
6263
@Override
6364
public void onBackPressed() {
6465
if (otherPage == true) {
@@ -72,4 +73,5 @@ public void onBackPressed() {
7273
startActivity(intent);
7374
}
7475
}
76+
*/
7577
}

0 commit comments

Comments
 (0)