From 25dff5ae6a5668bf51a5033be0906e1167639bb9 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 27 Feb 2012 20:29:22 +0100 Subject: [PATCH] Don't choke on invalid size parameters for attachment parts --- src/com/fsck/k9/view/AttachmentView.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/view/AttachmentView.java b/src/com/fsck/k9/view/AttachmentView.java index 316668a4f..72f2b8cea 100644 --- a/src/com/fsck/k9/view/AttachmentView.java +++ b/src/com/fsck/k9/view/AttachmentView.java @@ -155,7 +155,13 @@ public class AttachmentView extends FrameLayout { mController = controller; mListener = listener; - size = Integer.parseInt(MimeUtility.getHeaderParameter(contentDisposition, "size")); + String sizeParam = MimeUtility.getHeaderParameter(contentDisposition, "size"); + if (sizeParam != null) { + try { + size = Integer.parseInt(sizeParam); + } catch (NumberFormatException e) { /* ignore */ } + } + contentType = MimeUtility.getMimeTypeForViewing(part.getMimeType(), name); TextView attachmentName = (TextView) findViewById(R.id.attachment_name); TextView attachmentInfo = (TextView) findViewById(R.id.attachment_info);