Prevent crash

pull/183/head
M66B 4 years ago
parent 30c61eeaa0
commit 8da409115e

@ -2042,10 +2042,10 @@ public class FragmentCompose extends FragmentBase {
if (draft == null)
throw new MessageRemovedException("PGP");
if (draft.identity == null)
throw new IllegalArgumentException(getString(R.string.title_from_missing));
throw new IllegalArgumentException(context.getString(R.string.title_from_missing));
EntityIdentity identity = db.identity().getIdentity(draft.identity);
if (identity == null)
throw new IllegalArgumentException(getString(R.string.title_from_missing));
throw new IllegalArgumentException(context.getString(R.string.title_from_missing));
// Create files
File input = new File(context.getCacheDir(), "pgp_input." + draft.id);
@ -2349,7 +2349,7 @@ public class FragmentCompose extends FragmentBase {
throw new MessageRemovedException("S/MIME");
EntityIdentity identity = db.identity().getIdentity(draft.identity);
if (identity == null)
throw new IllegalArgumentException(getString(R.string.title_from_missing));
throw new IllegalArgumentException(context.getString(R.string.title_from_missing));
// Get/clean attachments
List<EntityAttachment> attachments = db.attachment().getAttachments(id);
@ -3090,7 +3090,7 @@ public class FragmentCompose extends FragmentBase {
data.identities = db.identity().getComposableIdentities(null);
if (data.identities == null || data.identities.size() == 0)
throw new IllegalStateException(getString(R.string.title_no_identities));
throw new IllegalStateException(context.getString(R.string.title_no_identities));
data.draft = db.message().getMessage(id);
if (data.draft == null || data.draft.ui_hide) {

@ -5624,12 +5624,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
List<String> users = sigResult.getConfirmedUserIds();
String text;
if (users.size() > 0)
text = getString(sresult == RESULT_VALID_KEY_UNCONFIRMED
text = context.getString(sresult == RESULT_VALID_KEY_UNCONFIRMED
? R.string.title_signature_unconfirmed_from
: R.string.title_signature_valid_from,
TextUtils.join(", ", users));
else
text = getString(sresult == RESULT_VALID_KEY_UNCONFIRMED
text = context.getString(sresult == RESULT_VALID_KEY_UNCONFIRMED
? R.string.title_signature_unconfirmed
: R.string.title_signature_valid);
args.putString("sigresult", text);
@ -5638,7 +5638,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} else if (sresult == RESULT_KEY_MISSING)
args.putString("sigresult", context.getString(R.string.title_signature_key_missing));
else {
String text = getString(R.string.title_signature_invalid_reason, Integer.toString(sresult));
String text = context.getString(R.string.title_signature_invalid_reason, Integer.toString(sresult));
args.putString("sigresult", text);
}
@ -6693,7 +6693,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (message.from != null && message.from.length > 0) {
Element span = document.createElement("span");
Element strong = document.createElement("strong");
strong.text(getString(R.string.title_from));
strong.text(context.getString(R.string.title_from));
span.appendChild(strong);
span.appendText(" " + MessageHelper.formatAddresses(message.from));
span.appendElement("br");
@ -6703,7 +6703,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (message.to != null && message.to.length > 0) {
Element span = document.createElement("span");
Element strong = document.createElement("strong");
strong.text(getString(R.string.title_to));
strong.text(context.getString(R.string.title_to));
span.appendChild(strong);
span.appendText(" " + MessageHelper.formatAddresses(message.to));
span.appendElement("br");
@ -6713,7 +6713,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (message.cc != null && message.cc.length > 0) {
Element span = document.createElement("span");
Element strong = document.createElement("strong");
strong.text(getString(R.string.title_cc));
strong.text(context.getString(R.string.title_cc));
span.appendChild(strong);
span.appendText(" " + MessageHelper.formatAddresses(message.cc));
span.appendElement("br");
@ -6725,7 +6725,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Element span = document.createElement("span");
Element strong = document.createElement("strong");
strong.text(getString(R.string.title_received));
strong.text(context.getString(R.string.title_received));
span.appendChild(strong);
span.appendText(" " + DTF.format(message.received));
span.appendElement("br");
@ -6757,7 +6757,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (attachment.isAttachment()) {
hasAttachments = true;
Element strong = document.createElement("strong");
strong.text(getString(R.string.title_attachment));
strong.text(context.getString(R.string.title_attachment));
footer.appendChild(strong);
if (!TextUtils.isEmpty(attachment.name))
footer.appendText(" " + attachment.name);

Loading…
Cancel
Save