From 2a73338d3424e9907b46a19f2288d61c9f885006 Mon Sep 17 00:00:00 2001 From: Chris Bowditch Date: Mon, 13 Mar 2023 10:56:44 +0000 Subject: [PATCH] Add fix for NPE related to FOP-3098 by Jeremias Maerki --- .../layoutmgr/list/ListItemLayoutManager.java | 1 + .../list-block_npe_bug_empty_2nd_block.xml | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 fop/test/layoutengine/standard-testcases/list-block_npe_bug_empty_2nd_block.xml 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 + + + + + + + + + + + + +
+ -- 2.39.5