From f4086dd275b290d9793b7e401be8f35d7c299938 Mon Sep 17 00:00:00 2001 From: Simon Pepping Date: Thu, 9 Dec 2010 09:00:24 +0000 Subject: [PATCH] Avoid an NPE in InlineStackingLM.applyChanges for Knuth elements with a null position; resolves bug 50276 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1043871 13f79535-47bb-0310-9956-ffa450edef68 --- .../inline/InlineStackingLayoutManager.java | 5 ++- .../knuth_element-null_position.xml | 44 +++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 test/layoutengine/standard-testcases/knuth_element-null_position.xml diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java index 4a6a59615..bcc03b956 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java @@ -285,8 +285,9 @@ public abstract class InlineStackingLayoutManager extends AbstractLayoutManager KnuthElement oldElement; while (oldListIterator.hasNext()) { oldElement = (KnuthElement) oldListIterator.next(); - oldElement.setPosition - (oldElement.getPosition().getPosition()); + if (oldElement.getPosition() != null) { + oldElement.setPosition(oldElement.getPosition().getPosition()); + } } // reset the iterator oldListIterator = oldList.listIterator(); diff --git a/test/layoutengine/standard-testcases/knuth_element-null_position.xml b/test/layoutengine/standard-testcases/knuth_element-null_position.xml new file mode 100644 index 000000000..cf964fdf5 --- /dev/null +++ b/test/layoutengine/standard-testcases/knuth_element-null_position.xml @@ -0,0 +1,44 @@ + + + + + +

This check tests that Knuth elements with a null position do +not cause a NPE (in InlineStackingLM.applyChanges)

+
+ + + + + + + + + + + + Abluftanlage + + + + + + + + +
-- 2.39.5