Cumulative corrections for Milos msgs in 2019, 7 Nov about try/catch and missed 'if null' contition

This commit is contained in:
fabriziocasellato 2019-11-11 09:57:35 +01:00
parent 86d4b755ea
commit 2319536adc

View file

@ -792,9 +792,8 @@ public class SmsCommunicatorPlugin extends PluginBase {
messageToConfirm = new AuthRequest(this, receivedSms, reply, passCode, new SmsAction() { messageToConfirm = new AuthRequest(this, receivedSms, reply, passCode, new SmsAction() {
@Override @Override
public void run() { public void run() {
try { Profile currentProfile = ProfileFunctions.getInstance().getProfile();
Profile currentProfile = ProfileFunctions.getInstance().getProfile(); if (currentProfile != null) {
int keyDuration = 0; int keyDuration = 0;
Integer defaultTargetDuration = 0; Integer defaultTargetDuration = 0;
int keyTarget = 0; int keyTarget = 0;
@ -843,9 +842,8 @@ public class SmsCommunicatorPlugin extends PluginBase {
String reply = String.format(MainApp.gs(R.string.smscommunicator_tt_set), ttString, ttDuration); String reply = String.format(MainApp.gs(R.string.smscommunicator_tt_set), ttString, ttDuration);
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply)); sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply));
} catch (Exception e) { } else {
sendSMS(new Sms(receivedSms.phoneNumber, R.string.smscommunicator_unknowncommand)); sendSMS(new Sms(receivedSms.phoneNumber, R.string.smscommunicator_unknowncommand));
return;
} }
} }
}); });
@ -864,15 +862,9 @@ public class SmsCommunicatorPlugin extends PluginBase {
messageToConfirm = new AuthRequest(this, receivedSms, reply, passCode, new SmsAction() { messageToConfirm = new AuthRequest(this, receivedSms, reply, passCode, new SmsAction() {
@Override @Override
public void run() { public void run() {
try { SP.putBoolean(R.string.key_smscommunicator_remotecommandsallowed, false);
SP.putBoolean(R.string.key_smscommunicator_remotecommandsallowed, false); String reply = String.format(MainApp.gs(R.string.smscommunicator_stoppedsms));
String reply = String.format(MainApp.gs(R.string.smscommunicator_stoppedsms)); sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply));
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply));
} catch (Exception e) {
e.printStackTrace();
sendSMS(new Sms(receivedSms.phoneNumber, R.string.smscommunicator_unknowncommand));
return;
}
} }
}); });
} else } else