check if pgpengine is still bound before using it

This commit is contained in:
Daniel Gultsch 2016-05-12 11:30:44 +02:00
parent 1bc92482e9
commit 09e20f6e01
3 changed files with 5 additions and 2 deletions

View file

@ -44,7 +44,7 @@ public class PresenceGenerator extends AbstractGenerator {
} }
packet.setFrom(account.getJid()); packet.setFrom(account.getJid());
String sig = account.getPgpSignature(); String sig = account.getPgpSignature();
if (sig != null) { if (sig != null && mXmppConnectionService.getPgpEngine() != null) {
packet.addChild("x", "jabber:x:signed").setContent(sig); packet.addChild("x", "jabber:x:signed").setContent(sig);
} }
String capHash = getCapHash(); String capHash = getCapHash();

View file

@ -118,7 +118,7 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis
xmppConnectionService.changeStatus(status, statusMessage); xmppConnectionService.changeStatus(status, statusMessage);
finish(); finish();
} else if (mAccount != null) { } else if (mAccount != null) {
if (mAccount.getPgpId() == 0) { if (mAccount.getPgpId() == 0 && hasPgp()) {
xmppConnectionService.changeStatus(mAccount, status, statusMessage, true); xmppConnectionService.changeStatus(mAccount, status, statusMessage, true);
finish(); finish();
} else { } else {

View file

@ -540,6 +540,9 @@ public abstract class XmppActivity extends Activity {
} }
protected boolean noAccountUsesPgp() { protected boolean noAccountUsesPgp() {
if (!hasPgp()) {
return true;
}
for(Account account : xmppConnectionService.getAccounts()) { for(Account account : xmppConnectionService.getAccounts()) {
if (account.getPgpId() != 0) { if (account.getPgpId() != 0) {
return false; return false;