Avoid null pointers

This commit is contained in:
stom79 2017-11-18 19:39:53 +01:00
parent 9bb2af8bee
commit c407f92ef7
1 changed files with 4 additions and 2 deletions

View File

@ -238,7 +238,8 @@ public class HttpsConnection {
} catch (IOException e) {
Error error = new Error();
error.setError(context.getString(R.string.toast_error));
httpsURLConnection.disconnect();
if(httpsURLConnection != null)
httpsURLConnection.disconnect();
e.printStackTrace();
}
@ -372,7 +373,8 @@ public class HttpsConnection {
}});
final Error error = new Error();
error.setError(e.getMessage());
httpsURLConnection.disconnect();
if(httpsURLConnection != null)
httpsURLConnection.disconnect();
((TootActivity)context).runOnUiThread(new Runnable() {
public void run() {
listener.onRetrieveAttachment(null, error);