]> source.dussan.org Git - poi.git/commitdiff
Apply patch from bug #51974 - Avoid HWPF issue when identifying the picture type
authorNick Burch <nick@apache.org>
Sat, 15 Oct 2011 14:14:53 +0000 (14:14 +0000)
committerNick Burch <nick@apache.org>
Sat, 15 Oct 2011 14:14:53 +0000 (14:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1183645 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java

index 4e29144f8a9c2b4fe56a8bb0a702eba3800a361a..1f3b4e7c7b15eeffc2a3842ed0265e40ccc96724 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta5" date="2011-??-??">
+           <action dev="poi-developers" type="fix">51974 - Avoid HWPF issue when identifying the picture type</action>
            <action dev="poi-developers" type="fix">52035 - Fix signed issue with very large word 6 files</action>
            <action dev="poi-developers" type="fix">51949 - Avoid NPE on double close of ZipFileZipEntrySource</action>
            <action dev="poi-developers" type="fix">51950 - XWPF fix for footnotes not always being present in a document</action>
index 555beb7b111992dd1ced490321bb35aad5c68138..06e84a4f112d45c8ff93e995f355ed11af350f80 100644 (file)
@@ -432,7 +432,9 @@ public final class Picture
      */
     public byte[] getRawContent()
     {
-        if ( _picfAndOfficeArtData.getBlipRecords().size() != 1 )
+        if ( _picfAndOfficeArtData == null ||
+                _picfAndOfficeArtData.getBlipRecords()== null || 
+                _picfAndOfficeArtData.getBlipRecords().size() != 1 )
             return new byte[0];
 
         EscherRecord escherRecord = _picfAndOfficeArtData.getBlipRecords().get(
@@ -516,7 +518,9 @@ public final class Picture
 
     public PictureType suggestPictureType()
     {
-        if ( _picfAndOfficeArtData.getBlipRecords().size() != 1 )
+        if ( _picfAndOfficeArtData == null ||
+                _picfAndOfficeArtData.getBlipRecords()== null || 
+                _picfAndOfficeArtData.getBlipRecords().size() != 1 )
             return PictureType.UNKNOWN;
 
         EscherRecord escherRecord = _picfAndOfficeArtData.getBlipRecords().get(