diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-10 13:19:58 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-04-10 13:19:58 +0200 |
commit | ba0bedc5facabc573023925660d7d49b27d5c68c (patch) | |
tree | 3d67c1dbaf929eb746563d1de0eb1bcdc5206de7 | |
parent | 298c7adcd1fabccb06d14905041cb7e008f109ad (diff) |
changed behaviour of expecption handler to check if accounts are working before removing the stacktrace
-rw-r--r-- | src/eu/siacs/conversations/utils/ExceptionHelper.java | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/eu/siacs/conversations/utils/ExceptionHelper.java b/src/eu/siacs/conversations/utils/ExceptionHelper.java index c6e857c0..f9cd375e 100644 --- a/src/eu/siacs/conversations/utils/ExceptionHelper.java +++ b/src/eu/siacs/conversations/utils/ExceptionHelper.java @@ -34,6 +34,18 @@ public class ExceptionHelper { if (neverSend) { return; } + List<Account> accounts = service.getAccounts(); + Account account = null; + for(int i = 0; i < accounts.size(); ++i) { + if (!accounts.get(i).isOptionSet(Account.OPTION_DISABLED)) { + account = accounts.get(i); + break; + } + } + if (account==null) { + return; + } + final Account finalAccount = account; FileInputStream file = context.openFileInput("stacktrace.txt"); InputStreamReader inputStreamReader = new InputStreamReader( file); @@ -54,20 +66,11 @@ public class ExceptionHelper { @Override public void onClick(DialogInterface dialog, int which) { - List<Account> accounts = service.getAccounts(); - Account account = null; - for(int i = 0; i < accounts.size(); ++i) { - if (!accounts.get(i).isOptionSet(Account.OPTION_DISABLED)) { - account = accounts.get(i); - break; - } - } - if (account!=null) { - Log.d("xmppService","using account="+account.getJid()+" to send in stack trace"); - Conversation conversation = service.findOrCreateConversation(account, "bugs@siacs.eu", false); + + Log.d("xmppService","using account="+finalAccount.getJid()+" to send in stack trace"); + Conversation conversation = service.findOrCreateConversation(finalAccount, "bugs@siacs.eu", false); Message message = new Message(conversation, stacktrace.toString(), Message.ENCRYPTION_NONE); service.sendMessage(message, null); - } } }); builder.setNegativeButton(context.getText(R.string.send_never),new OnClickListener() { |