diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index 4477801f2cd..db590bfaa76 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -400,7 +400,8 @@ public void updateData2(KnuthNode bestActiveNode, InlineLevelEventProducer eventProducer = InlineLevelEventProducer.Provider.get( getFObj().getUserAgent().getEventBroadcaster()); - if (curChildLM.getFObj() == null) { + // curChildLM is null on the float re-layout pass (PageBreaker.handleFloatLayout) + if (curChildLM == null || curChildLM.getFObj() == null) { eventProducer.lineOverflows(this, getFObj().getName(), bestActiveNode.line, -lack, getFObj().getLocator()); } else { diff --git a/fop/test/layoutengine/standard-testcases/float_overflow_relayout.xml b/fop/test/layoutengine/standard-testcases/float_overflow_relayout.xml new file mode 100644 index 00000000000..b013744e4ce --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/float_overflow_relayout.xml @@ -0,0 +1,46 @@ + + + + + +

+ This test checks a line that overflows beside a float wider than the measure. On the float + re-layout pass the line breaking algorithm reported the overflow through curChildLM, which + is null there, and FOP threw a NullPointerException instead of reporting it. +

+
+ + + + + + + + + + + block childOverflowing ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ + + + + + + + + +