Fixed crash, simplification

pull/72/head
M66B 6 years ago
parent e3b4674378
commit e8032df960

@ -865,9 +865,9 @@ public class FragmentCompose extends FragmentEx {
final String action = getArguments().getString("action"); final String action = getArguments().getString("action");
Log.i(Helper.TAG, "Loaded draft id=" + draft.id + " action=" + action); Log.i(Helper.TAG, "Loaded draft id=" + draft.id + " action=" + action);
etTo.setText(draft.to == null ? null : MessageHelper.getFormattedAddresses(draft.to, true)); etTo.setText(MessageHelper.getFormattedAddresses(draft.to, true));
etCc.setText(draft.cc == null ? null : MessageHelper.getFormattedAddresses(draft.cc, true)); etCc.setText(MessageHelper.getFormattedAddresses(draft.cc, true));
etBcc.setText(draft.bcc == null ? null : MessageHelper.getFormattedAddresses(draft.bcc, true)); etBcc.setText(MessageHelper.getFormattedAddresses(draft.bcc, true));
etSubject.setText(draft.subject); etSubject.setText(draft.subject);
etBody.setText(null); etBody.setText(null);

@ -375,16 +375,16 @@ public class FragmentMessage extends FragmentEx {
if (savedInstanceState == null) { if (savedInstanceState == null) {
setSubtitle(Helper.localizeFolderName(getContext(), message.folderName)); setSubtitle(Helper.localizeFolderName(getContext(), message.folderName));
tvFrom.setText(message.from == null ? null : MessageHelper.getFormattedAddresses(message.from, true)); tvFrom.setText(MessageHelper.getFormattedAddresses(message.from, true));
tvTime.setText(message.sent == null ? null : df.format(new Date(message.sent))); tvTime.setText(message.sent == null ? null : df.format(new Date(message.sent)));
tvTo.setText(message.to == null ? null : MessageHelper.getFormattedAddresses(message.to, true)); tvTo.setText(MessageHelper.getFormattedAddresses(message.to, true));
tvSubject.setText(message.subject); tvSubject.setText(message.subject);
tvCount.setText(Integer.toString(message.count)); tvCount.setText(Integer.toString(message.count));
tvReplyTo.setText(message.reply == null ? null : MessageHelper.getFormattedAddresses(message.reply, true)); tvReplyTo.setText(MessageHelper.getFormattedAddresses(message.reply, true));
tvCc.setText(message.cc == null ? null : MessageHelper.getFormattedAddresses(message.cc, true)); tvCc.setText(MessageHelper.getFormattedAddresses(message.cc, true));
tvBcc.setText(message.bcc == null ? null : MessageHelper.getFormattedAddresses(message.bcc, true)); tvBcc.setText(MessageHelper.getFormattedAddresses(message.bcc, true));
tvError.setText(message.error); tvError.setText(message.error);
} else { } else {

@ -252,8 +252,8 @@ public class MessageHelper {
} }
static String getFormattedAddresses(Address[] addresses, boolean full) { static String getFormattedAddresses(Address[] addresses, boolean full) {
if (addresses == null) if (addresses == null || addresses.length == 0)
return null; return "";
List<String> formatted = new ArrayList<>(); List<String> formatted = new ArrayList<>();
for (Address address : addresses) for (Address address : addresses)

Loading…
Cancel
Save