From 88dc36da8a49ea51fb921e8adff1c32897edc4dc Mon Sep 17 00:00:00 2001 From: cketti Date: Sat, 1 Oct 2011 20:30:22 +0200 Subject: [PATCH] Added a check to prevent an ArrayIndexOutOfBoundsException Fixes issue 3683 --- src/com/fsck/k9/view/SingleMessageView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/view/SingleMessageView.java b/src/com/fsck/k9/view/SingleMessageView.java index 5b84fc57f..29e0d9127 100644 --- a/src/com/fsck/k9/view/SingleMessageView.java +++ b/src/com/fsck/k9/view/SingleMessageView.java @@ -197,9 +197,12 @@ public class SingleMessageView extends LinearLayout { // button wasn't already pressed, see if the user's preferences has us // showing them anyway. if (Utility.hasExternalImages(text) && !showPictures()) { + Address[] from = message.getFrom(); if ((account.getShowPictures() == Account.ShowPictures.ALWAYS) || ((account.getShowPictures() == Account.ShowPictures.ONLY_FROM_CONTACTS) && - mContacts.isInContacts(message.getFrom()[0].getAddress()))) { + // Make sure we have at least one from address + (from != null && from.length > 0) && + mContacts.isInContacts(from[0].getAddress()))) { setLoadPictures(true); } else { showShowPicturesSection(true);