From: Chris Bowditch Date: Mon, 13 Mar 2023 10:56:44 +0000 (+0000) Subject: Add fix for NPE related to FOP-3098 by Jeremias Maerki X-Git-Tag: 2_9~28 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2a73338d3424e9907b46a19f2288d61c9f885006;p=xmlgraphics-fop.git Add fix for NPE related to FOP-3098 by Jeremias Maerki --- diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index a15e58ad4..9473db66c 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -498,6 +498,7 @@ public class ListItemLayoutManager extends SpacedBorderedPaddedBlockLayoutManage && position.getLM() instanceof ListItemContentLayoutManager) { position = position.getPosition(); if (position != null + && position.getPosition() != null && position.getLM() instanceof BlockLayoutManager) { retval = new LeafPosition(position.getPosition().getLM(), 0); } diff --git a/fop/test/layoutengine/standard-testcases/list-block_npe_bug_empty_2nd_block.xml b/fop/test/layoutengine/standard-testcases/list-block_npe_bug_empty_2nd_block.xml new file mode 100644 index 000000000..65547c838 --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/list-block_npe_bug_empty_2nd_block.xml @@ -0,0 +1,57 @@ + + + + + +

+ This test checks triggered a NPE in + in ListItemLayoutManager.extractBlock() on a null Position due to an empty second block. +

+
+ + + + + + + + + + + + + + + 1.1. + + + blah blah + + + + + + + + + + + + +
+