Fixes some errors

This commit is contained in:
stom79 2018-01-14 19:03:20 +01:00
parent 187ed3bb01
commit 157b0b1c3b
2 changed files with 7 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import java.lang.ref.WeakReference;
import fr.gouv.etalab.mastodon.client.API;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.client.Entities.Error;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveNotificationsInterface;
@ -59,6 +60,10 @@ public class RetrieveNotificationsAsyncTask extends AsyncTask<Void, Void, Void>
api = new API(this.contextReference.get());
apiResponse = api.getNotifications(max_id, display);
}else {
if( this.contextReference.get() == null) {
apiResponse.setError(new Error());
return null;
}
api = new API(this.contextReference.get(), account.getInstance(), account.getToken());
apiResponse = api.getNotificationsSince(max_id, display);
}

View File

@ -731,6 +731,8 @@ public class HttpsConnection {
private void getSinceMaxId(){
if( httpsURLConnection == null)
return;
Map<String, List<String>> map = httpsURLConnection.getHeaderFields();
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
if( entry.toString().startsWith("Link")){