Skip to content

Commit 5c0b032

Browse files
committed
Guard against null auth token label
Call equals method on constant which will never be null instead of auth token label variable
1 parent 6685e4d commit 5c0b032

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/src/main/java/com/github/mobile/accounts/AccountAuthenticator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public Bundle getAuthToken(AccountAuthenticatorResponse response,
7878

7979
@Override
8080
public String getAuthTokenLabel(String authTokenType) {
81-
if (authTokenType.equals(ACCOUNT_TYPE))
81+
if (ACCOUNT_TYPE.equals(authTokenType))
8282
return authTokenType;
8383
return null;
8484
}

app/src/main/java/com/github/mobile/accounts/LoginActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ protected void finishLogin() {
345345
authToken = password;
346346
intent.putExtra(KEY_ACCOUNT_NAME, username);
347347
intent.putExtra(KEY_ACCOUNT_TYPE, ACCOUNT_TYPE);
348-
if (authTokenType != null && authTokenType.equals(ACCOUNT_TYPE))
348+
if (ACCOUNT_TYPE.equals(authTokenType))
349349
intent.putExtra(KEY_AUTHTOKEN, authToken);
350350
setAccountAuthenticatorResult(intent.getExtras());
351351
setResult(RESULT_OK, intent);

0 commit comments

Comments
 (0)