]> source.dussan.org Git - poi.git/commitdiff
hwpf: ignore null-reference to parent stylesheet (bug#50688)
authorMaxim Valyanskiy <maxcom@apache.org>
Mon, 31 Jan 2011 09:27:44 +0000 (09:27 +0000)
committerMaxim Valyanskiy <maxcom@apache.org>
Mon, 31 Jan 2011 09:27:44 +0000 (09:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1065535 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java
test-data/document/parentinvguid.doc [new file with mode: 0644]

index babad02b8d3aa8d4764e11ea83bc4d8bb3907e9a..c3e66f6e780c36a6429ee4b067f9fbd3b40f4a4b 100644 (file)
@@ -238,6 +238,10 @@ public final class StyleSheet implements HDFType {
 
           }
 
+          if (parentPAP == null) {
+              parentPAP = new ParagraphProperties();
+          }
+
           pap = ParagraphSprmUncompressor.uncompressPAP(parentPAP, papx, 2);
           sd.setPAP(pap);
       }
index d328dfe403151e9d1b9c9b290b220dbd38dc5d22..6f7affe085184d5b532068c66294e364806d8760 100644 (file)
@@ -38,4 +38,13 @@ public final class TestWordExtractorBugs extends TestCase {
                extractor.getParagraphText();
                extractor.getTextFromPieces();
        }
+
+    public void testBug50688() throws Exception {
+        WordExtractor extractor =
+            new WordExtractor(POIDataSamples.getDocumentInstance().openResourceAsStream("parentinvguid.doc"));
+
+        // Check it gives text without error
+        extractor.getText();
+    }
+    
 }
diff --git a/test-data/document/parentinvguid.doc b/test-data/document/parentinvguid.doc
new file mode 100644 (file)
index 0000000..f27cf3e
Binary files /dev/null and b/test-data/document/parentinvguid.doc differ