diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java index 19e67a46db..6a3a12d75f 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java @@ -254,6 +254,17 @@ public final class TestProblems extends HWPFTestCase { assertEquals("\n", ext.getHeaderText()); assertEquals("", ext.getFooterText()); } + + /** + * Bug #45877 - problematic PAPX with no parent set + */ + public void testParagraphPAPXNoParent45877() throws Exception { + HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug45877.doc"); + assertEquals(17, doc.getRange().numParagraphs()); + + assertEquals("First paragraph\r", doc.getRange().getParagraph(0).text()); + assertEquals("After Crashing Part\r", doc.getRange().getParagraph(13).text()); + } /** * Bug #48245 - don't include the text from the diff --git a/test-data/document/Bug45877.doc b/test-data/document/Bug45877.doc new file mode 100644 index 0000000000..af2d6eda14 Binary files /dev/null and b/test-data/document/Bug45877.doc differ