mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 20:54:34 +00:00
Prevent crash
This commit is contained in:
parent
30c61eeaa0
commit
8da409115e
2 changed files with 12 additions and 12 deletions
|
@ -2042,10 +2042,10 @@ public class FragmentCompose extends FragmentBase {
|
||||||
if (draft == null)
|
if (draft == null)
|
||||||
throw new MessageRemovedException("PGP");
|
throw new MessageRemovedException("PGP");
|
||||||
if (draft.identity == null)
|
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);
|
EntityIdentity identity = db.identity().getIdentity(draft.identity);
|
||||||
if (identity == null)
|
if (identity == null)
|
||||||
throw new IllegalArgumentException(getString(R.string.title_from_missing));
|
throw new IllegalArgumentException(context.getString(R.string.title_from_missing));
|
||||||
|
|
||||||
// Create files
|
// Create files
|
||||||
File input = new File(context.getCacheDir(), "pgp_input." + draft.id);
|
File input = new File(context.getCacheDir(), "pgp_input." + draft.id);
|
||||||
|
@ -2349,7 +2349,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
throw new MessageRemovedException("S/MIME");
|
throw new MessageRemovedException("S/MIME");
|
||||||
EntityIdentity identity = db.identity().getIdentity(draft.identity);
|
EntityIdentity identity = db.identity().getIdentity(draft.identity);
|
||||||
if (identity == null)
|
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
|
// Get/clean attachments
|
||||||
List<EntityAttachment> attachments = db.attachment().getAttachments(id);
|
List<EntityAttachment> attachments = db.attachment().getAttachments(id);
|
||||||
|
@ -3090,7 +3090,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
data.identities = db.identity().getComposableIdentities(null);
|
data.identities = db.identity().getComposableIdentities(null);
|
||||||
if (data.identities == null || data.identities.size() == 0)
|
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);
|
data.draft = db.message().getMessage(id);
|
||||||
if (data.draft == null || data.draft.ui_hide) {
|
if (data.draft == null || data.draft.ui_hide) {
|
||||||
|
|
|
@ -5624,12 +5624,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
List<String> users = sigResult.getConfirmedUserIds();
|
List<String> users = sigResult.getConfirmedUserIds();
|
||||||
String text;
|
String text;
|
||||||
if (users.size() > 0)
|
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_unconfirmed_from
|
||||||
: R.string.title_signature_valid_from,
|
: R.string.title_signature_valid_from,
|
||||||
TextUtils.join(", ", users));
|
TextUtils.join(", ", users));
|
||||||
else
|
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_unconfirmed
|
||||||
: R.string.title_signature_valid);
|
: R.string.title_signature_valid);
|
||||||
args.putString("sigresult", text);
|
args.putString("sigresult", text);
|
||||||
|
@ -5638,7 +5638,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
} else if (sresult == RESULT_KEY_MISSING)
|
} else if (sresult == RESULT_KEY_MISSING)
|
||||||
args.putString("sigresult", context.getString(R.string.title_signature_key_missing));
|
args.putString("sigresult", context.getString(R.string.title_signature_key_missing));
|
||||||
else {
|
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);
|
args.putString("sigresult", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6693,7 +6693,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
if (message.from != null && message.from.length > 0) {
|
if (message.from != null && message.from.length > 0) {
|
||||||
Element span = document.createElement("span");
|
Element span = document.createElement("span");
|
||||||
Element strong = document.createElement("strong");
|
Element strong = document.createElement("strong");
|
||||||
strong.text(getString(R.string.title_from));
|
strong.text(context.getString(R.string.title_from));
|
||||||
span.appendChild(strong);
|
span.appendChild(strong);
|
||||||
span.appendText(" " + MessageHelper.formatAddresses(message.from));
|
span.appendText(" " + MessageHelper.formatAddresses(message.from));
|
||||||
span.appendElement("br");
|
span.appendElement("br");
|
||||||
|
@ -6703,7 +6703,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
if (message.to != null && message.to.length > 0) {
|
if (message.to != null && message.to.length > 0) {
|
||||||
Element span = document.createElement("span");
|
Element span = document.createElement("span");
|
||||||
Element strong = document.createElement("strong");
|
Element strong = document.createElement("strong");
|
||||||
strong.text(getString(R.string.title_to));
|
strong.text(context.getString(R.string.title_to));
|
||||||
span.appendChild(strong);
|
span.appendChild(strong);
|
||||||
span.appendText(" " + MessageHelper.formatAddresses(message.to));
|
span.appendText(" " + MessageHelper.formatAddresses(message.to));
|
||||||
span.appendElement("br");
|
span.appendElement("br");
|
||||||
|
@ -6713,7 +6713,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
if (message.cc != null && message.cc.length > 0) {
|
if (message.cc != null && message.cc.length > 0) {
|
||||||
Element span = document.createElement("span");
|
Element span = document.createElement("span");
|
||||||
Element strong = document.createElement("strong");
|
Element strong = document.createElement("strong");
|
||||||
strong.text(getString(R.string.title_cc));
|
strong.text(context.getString(R.string.title_cc));
|
||||||
span.appendChild(strong);
|
span.appendChild(strong);
|
||||||
span.appendText(" " + MessageHelper.formatAddresses(message.cc));
|
span.appendText(" " + MessageHelper.formatAddresses(message.cc));
|
||||||
span.appendElement("br");
|
span.appendElement("br");
|
||||||
|
@ -6725,7 +6725,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
|
|
||||||
Element span = document.createElement("span");
|
Element span = document.createElement("span");
|
||||||
Element strong = document.createElement("strong");
|
Element strong = document.createElement("strong");
|
||||||
strong.text(getString(R.string.title_received));
|
strong.text(context.getString(R.string.title_received));
|
||||||
span.appendChild(strong);
|
span.appendChild(strong);
|
||||||
span.appendText(" " + DTF.format(message.received));
|
span.appendText(" " + DTF.format(message.received));
|
||||||
span.appendElement("br");
|
span.appendElement("br");
|
||||||
|
@ -6757,7 +6757,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
if (attachment.isAttachment()) {
|
if (attachment.isAttachment()) {
|
||||||
hasAttachments = true;
|
hasAttachments = true;
|
||||||
Element strong = document.createElement("strong");
|
Element strong = document.createElement("strong");
|
||||||
strong.text(getString(R.string.title_attachment));
|
strong.text(context.getString(R.string.title_attachment));
|
||||||
footer.appendChild(strong);
|
footer.appendChild(strong);
|
||||||
if (!TextUtils.isEmpty(attachment.name))
|
if (!TextUtils.isEmpty(attachment.name))
|
||||||
footer.appendText(" " + attachment.name);
|
footer.appendText(" " + attachment.name);
|
||||||
|
|
Loading…
Reference in a new issue