Skip to content

Commit

Permalink
Fixed null pointer error when trying to get the login info (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
s7092910 authored and comann committed Jul 29, 2016
1 parent d049833 commit 0b8ad2c
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;

Expand Down Expand Up @@ -63,16 +64,18 @@ public LoginInfo getLoginInfo() {
String password = null;

for (String s :info) {
if(s.contains(INFO_TOKEN)){
token = getStoredString(s);
continue;
}
if(s.contains(INFO_USERNAME)){
username = getStoredString(s);
continue;
}
if(s.contains(INFO_PASSWORD)){
password = getStoredString(s);
if(!TextUtils.isEmpty(s)) {
if (s.contains(INFO_TOKEN)) {
token = getStoredString(s);
continue;
}
if (s.contains(INFO_USERNAME)) {
username = getStoredString(s);
continue;
}
if (s.contains(INFO_PASSWORD)) {
password = getStoredString(s);
}
}
}
return new PtcLoginInfo(token, username, password);
Expand All @@ -88,12 +91,14 @@ public LoginInfo getLoginInfo() {
String refresh = null;

for (String s :info) {
if(s.contains(INFO_TOKEN)){
token = getStoredString(s);
continue;
}
if(s.contains(INFO_PASSWORD)){
refresh = getStoredString(s);
if(!TextUtils.isEmpty(s)) {
if (s.contains(INFO_TOKEN)) {
token = getStoredString(s);
continue;
}
if (s.contains(INFO_PASSWORD)) {
refresh = getStoredString(s);
}
}
}

Expand Down

0 comments on commit 0b8ad2c

Please sign in to comment.