OSDN Git Service

Added check for null resource during indexing.
authorRandy Baumgarte <randy@fbn.cx>
Wed, 4 Apr 2012 18:06:24 +0000 (14:06 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Wed, 4 Apr 2012 18:06:24 +0000 (14:06 -0400)
src/cx/fbn/nevernote/threads/IndexRunner.java

index f0afc15..6a25802 100644 (file)
@@ -302,36 +302,38 @@ public class IndexRunner extends QObject implements Runnable {
        \r
        private void indexResourceContent(String guid) {\r
                Resource r = conn.getNoteTable().noteResourceTable.getNoteResource(guid, true);\r
-               if (r.getMime().equalsIgnoreCase("application/pdf")) {\r
-                       indexResourcePDF(r);\r
-                       return;\r
-               }\r
-               if (r.getMime().equalsIgnoreCase("application/docx") || \r
-                       r.getMime().equalsIgnoreCase("application/xlsx") || \r
-                       r.getMime().equalsIgnoreCase("application/pptx")) {\r
-                       indexResourceOOXML(r);\r
-                       return;\r
-               }\r
-               if (r.getMime().equalsIgnoreCase("application/vsd") ||\r
-                       r.getMime().equalsIgnoreCase("application/ppt") ||\r
-                       r.getMime().equalsIgnoreCase("application/xls") ||\r
-                       r.getMime().equalsIgnoreCase("application/msg") ||\r
-                       r.getMime().equalsIgnoreCase("application/doc")) {\r
+               if (r != null && r.getMime() != null) {\r
+                       if (r.getMime().equalsIgnoreCase("application/pdf")) {\r
+                               indexResourcePDF(r);\r
+                               return;\r
+                       }\r
+                       if (r.getMime().equalsIgnoreCase("application/docx") || \r
+                               r.getMime().equalsIgnoreCase("application/xlsx") || \r
+                               r.getMime().equalsIgnoreCase("application/pptx")) {\r
+                               indexResourceOOXML(r);\r
+                               return;\r
+                       }\r
+                       if (r.getMime().equalsIgnoreCase("application/vsd") ||\r
+                                       r.getMime().equalsIgnoreCase("application/ppt") ||\r
+                                       r.getMime().equalsIgnoreCase("application/xls") ||\r
+                                       r.getMime().equalsIgnoreCase("application/msg") ||\r
+                                       r.getMime().equalsIgnoreCase("application/doc")) {\r
                                indexResourceOffice(r);\r
                                return;\r
-               }\r
-               if (r.getMime().equalsIgnoreCase("application/rtf")) {\r
+                       }\r
+                       if (r.getMime().equalsIgnoreCase("application/rtf")) {\r
                                        indexResourceRTF(r);\r
                                        return;\r
-               }\r
-               if (r.getMime().equalsIgnoreCase("application/odf") ||\r
-                       r.getMime().equalsIgnoreCase("application/odt") ||\r
-                       r.getMime().equalsIgnoreCase("application/odp") ||\r
-                       r.getMime().equalsIgnoreCase("application/odg") ||\r
-                       r.getMime().equalsIgnoreCase("application/odb") ||\r
-                       r.getMime().equalsIgnoreCase("application/ods")) {\r
-                       indexResourceODF(r);\r
-                       return;\r
+                       }\r
+                       if (r.getMime().equalsIgnoreCase("application/odf") ||\r
+                               r.getMime().equalsIgnoreCase("application/odt") ||\r
+                               r.getMime().equalsIgnoreCase("application/odp") ||\r
+                               r.getMime().equalsIgnoreCase("application/odg") ||\r
+                               r.getMime().equalsIgnoreCase("application/odb") ||\r
+                               r.getMime().equalsIgnoreCase("application/ods")) {\r
+                               indexResourceODF(r);\r
+                               return;\r
+                       }\r
                }\r
        }\r
 \r