npe checks

This commit is contained in:
Daniel Gultsch 2017-02-17 10:26:42 +01:00
parent cf9ab4d302
commit c69ad8f52c
2 changed files with 8 additions and 3 deletions

View file

@ -3088,7 +3088,10 @@ public class XmppConnectionService extends Service {
disconnect(account, force || account.getTrueStatus().isError() || !hasInternet); disconnect(account, force || account.getTrueStatus().isError() || !hasInternet);
account.getRoster().clearPresences(); account.getRoster().clearPresences();
connection.resetEverything(); connection.resetEverything();
account.getAxolotlService().resetBrokenness(); final AxolotlService axolotlService = account.getAxolotlService();
if (axolotlService != null) {
axolotlService.resetBrokenness();
}
if (!hasInternet) { if (!hasInternet) {
account.setStatus(Account.State.NO_INTERNET); account.setStatus(Account.State.NO_INTERNET);
} }

View file

@ -100,7 +100,7 @@ public class XmppConnection implements Runnable {
private final WakeLock wakeLock; private final WakeLock wakeLock;
private Socket socket; private Socket socket;
private XmlReader tagReader; private XmlReader tagReader;
private TagWriter tagWriter; private TagWriter tagWriter = new TagWriter();
private final Features features = new Features(this); private final Features features = new Features(this);
private boolean needsBinding = true; private boolean needsBinding = true;
private boolean shouldAuthenticate = true; private boolean shouldAuthenticate = true;
@ -449,7 +449,9 @@ public class XmppConnection implements Runnable {
} }
this.socket = socket; this.socket = socket;
tagReader = new XmlReader(wakeLock); tagReader = new XmlReader(wakeLock);
if (tagWriter != null) tagWriter.forceClose(); if (tagWriter != null) {
tagWriter.forceClose();
}
tagWriter = new TagWriter(); tagWriter = new TagWriter();
tagWriter.setOutputStream(socket.getOutputStream()); tagWriter.setOutputStream(socket.getOutputStream());
tagReader.setInputStream(socket.getInputStream()); tagReader.setInputStream(socket.getInputStream());