mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-30 19:34:45 +01:00
Fix some NullPointerException.
This commit is contained in:
parent
5c31c21d06
commit
c213cc0962
@ -83,7 +83,7 @@ public class SubredditListingDataSource extends PageKeyedDataSource<String, Subr
|
|||||||
this.params = params;
|
this.params = params;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
|
||||||
if (params.key.equals("") || params.key.equals("null")) {
|
if (params.key == null || params.key.equals("") || params.key.equals("null")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,29 +70,30 @@ public class ParseUserData {
|
|||||||
private static class ParseUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
|
private static class ParseUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
private JSONObject jsonResponse;
|
private JSONObject jsonResponse;
|
||||||
private ParseUserDataListener parseUserDataListener;
|
private ParseUserDataListener parseUserDataListener;
|
||||||
private boolean parseFailed;
|
private boolean parseFailed = false;
|
||||||
|
|
||||||
private UserData userData;
|
private UserData userData;
|
||||||
|
|
||||||
ParseUserDataAsyncTask(String response, ParseUserDataListener parseUserDataListener) {
|
ParseUserDataAsyncTask(String response, ParseUserDataListener parseUserDataListener) {
|
||||||
|
this.parseUserDataListener = parseUserDataListener;
|
||||||
try {
|
try {
|
||||||
jsonResponse = new JSONObject(response);
|
jsonResponse = new JSONObject(response);
|
||||||
this.parseUserDataListener = parseUserDataListener;
|
|
||||||
parseFailed = false;
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
parseFailed = true;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
parseUserDataListener.onParseUserDataFailed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
|
if (!parseFailed) {
|
||||||
try {
|
try {
|
||||||
userData = parseUserDataBase(jsonResponse, true);
|
userData = parseUserDataBase(jsonResponse, true);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
parseFailed = true;
|
parseFailed = true;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user