// get elements from curLM
returnedList = curLM.getNextKnuthElements(childLC, alignment);
- if (returnedList.size() == 1
+ if (returnedList != null
+ && returnedList.size() == 1
&& ((KnuthElement) returnedList.getFirst()).isPenalty()
&& ((KnuthPenalty) returnedList.getFirst()).getP() == -KnuthElement.INFINITE) {
// a descendant of this block has break-before
// a penalty
}
}
- if (returnedList.size() == 0) {
+ if (returnedList == null || returnedList.size() == 0) {
//Avoid NoSuchElementException below (happens with empty blocks)
continue;
}
= curLM.getNextKnuthElements(inlineLC,
effectiveAlignment))
!= null) {
+ if (returnedList.size() == 0) {
+ continue;
+ }
// look at the first element
thisElement = (KnuthElement) returnedList.getFirst();
if (thisElement.isBox() && !thisElement.isAuxiliary()