Don't choke on invalid size parameters for attachment parts

This commit is contained in:
cketti 2012-02-27 20:29:22 +01:00
parent 2cb31a2fac
commit 25dff5ae6a

View file

@ -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);