From dec7fd4c8a5b8884831ae813feed09b69e41fd3a Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Tue, 25 Feb 2014 17:54:49 -0800 Subject: [PATCH] Fix for NPE with audio attachments. --- src/org/thoughtcrime/securesms/mms/AudioSlide.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/mms/AudioSlide.java b/src/org/thoughtcrime/securesms/mms/AudioSlide.java index ee27e9e951..f0df498fa8 100644 --- a/src/org/thoughtcrime/securesms/mms/AudioSlide.java +++ b/src/org/thoughtcrime/securesms/mms/AudioSlide.java @@ -67,11 +67,12 @@ public class AudioSlide extends Slide { cursor = context.getContentResolver().query(uri, new String[]{Audio.Media.MIME_TYPE}, null, null, null); if (cursor != null && cursor.moveToFirst()) - part.setContentType(cursor.getString(0).getBytes()); + part.setContentType(cursor.getString(0).getBytes()); else - throw new IOException("Unable to query content type."); + throw new IOException("Unable to query content type."); } finally { - cursor.close(); + if (cursor != null) + cursor.close(); } part.setDataUri(uri);