From d71f80e6a1a4b00ba41d27b1b4d5a6d2160a6215 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sat, 15 Oct 2011 14:14:53 +0000 Subject: [PATCH] Apply patch from bug #51974 - Avoid HWPF issue when identifying the picture type git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1183645 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../src/org/apache/poi/hwpf/usermodel/Picture.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 4e29144f8..1f3b4e7c7 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 51974 - Avoid HWPF issue when identifying the picture type 52035 - Fix signed issue with very large word 6 files 51949 - Avoid NPE on double close of ZipFileZipEntrySource 51950 - XWPF fix for footnotes not always being present in a document diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java index 555beb7b1..06e84a4f1 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java @@ -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(