Fix Tags app NPE. rel-roth-mp-3-partner rel-roth-ota-1-partner rel-tegranote-r1-partner rel-tegranote-r2-partner rel-tegratab-partner daily-2013.07.26.0_rel-roth-mp-3-partner daily-2013.07.26.1_rel-roth-mp-3-partner daily-2013.07.29.0_rel-roth-mp-3-partner daily-2013.07.29.1_rel-roth-mp-3-partner daily-2013.07.29.2_rel-roth-mp-3-partner daily-2013.07.31.1_rel-roth-ota-1-partner daily-2013.09.09.0_rel-roth-ota-1-partner daily-2013.11.05.1_rel-tegranote-r2-partner daily-2013.11.07.0_rel-tegratab-partner daily-2013.11.07.1_rel-tegranote-r1-partner
Martijn Coenen [Thu, 6 Sep 2012 14:36:33 +0000 (16:36 +0200)]
mimeType parser can return null on some types.

Change-Id: I8bd8d9674686bcbdec47410d5f6700c6483a53db

src/com/android/apps/tag/record/ImageRecord.java

index 34af2ee..95eb329 100644 (file)
@@ -52,6 +52,9 @@ public class ImageRecord extends ParsedNdefRecord {
 
     public static ImageRecord parse(NdefRecord record) {
         String mimeType = record.toMimeType();
+        if (mimeType == null) {
+            throw new IllegalArgumentException("not a valid image file");
+        }
         Preconditions.checkArgument(mimeType.startsWith("image/"));
 
         // Try to ensure it's a legal, valid image