Buggy code:
public class LayoutUtils { public static List < InlineBox > createGeneratedInlines ( LayoutContext context , VEXElement pseudoElement ) { } public static boolean elementOrRangeContains ( Object elementOrRange , int offset ) { } private static String getGeneratedContent ( LayoutContext context , VEXElement pseudoElement ) { } public static void iterateChildrenByDisplayStyle ( StyleSheet styleSheet , Set < String > displayStyles , VEXElement element , int startOffset , int endOffset , ElementOrRangeCallback callback ) { List < VEXNode > nonMatching = new ArrayList < VEXNode > ( ) ; List < VEXNode > nodes = element . getChildNodes ( ) ; for ( int i = 0 ; i < ( nodes . size ( ) ) ; i ++ ) { if ( ( nodes . get ( i ) . getEndOffset ( ) ) <= startOffset ) { continue ; } else if ( ( nodes . get ( i ) . getStartOffset ( ) ) >= endOffset ) { break ; } else { VEXNode node = nodes . get ( i ) ; if ( node instanceof Element ) { Element childElement = ( ( Element ) ( node ) ) ; String display = styleSheet . getStyles ( childElement ) . getDisplay ( ) ; if ( displayStyles . contains ( display ) ) { <START_BUG> if ( ( nonMatching . size ( ) ) > 0 ) { <END_BUG> VEXNode firstNode = ( ( VEXNode ) ( nonMatching . get ( 0 ) ) ) ; VEXNode lastNode = ( ( VEXNode ) ( nonMatching . get ( ( ( nonMatching . size ( ) ) - 1 ) ) ) ) ; if ( lastNode instanceof Element ) { callback . onRange ( element , firstNode . getStartOffset ( ) , ( ( lastNode . getEndOffset ( ) ) + 1 ) ) ; } else { callback . onRange ( element , firstNode . getStartOffset ( ) , lastNode . getEndOffset ( ) ) ; } nonMatching . clear ( ) ; } callback . onElement ( childElement , display ) ; } else { nonMatching . add ( node ) ; } } else { nonMatching . add ( node ) ; } } } if ( ! ( nonMatching . isEmpty ( ) ) ) { VEXNode firstNode = ( ( VEXNode ) ( nonMatching . get ( 0 ) ) ) ; VEXNode lastNode = ( ( VEXNode ) ( nonMatching . get ( ( ( nonMatching . size ( ) ) - 1 ) ) ) ) ; if ( lastNode instanceof Element ) { callback . onRange ( element , firstNode . getStartOffset ( ) , ( ( lastNode . getEndOffset ( ) ) + 1 ) ) ; } else { callback . onRange ( element , firstNode . getStartOffset ( ) , lastNode . getEndOffset ( ) ) ; } } } public static void iterateChildrenByDisplayStyle ( StyleSheet styleSheet , Set < String > displayStyles , VEXElement table , ElementOrRangeCallback callback ) { } public static boolean isTableChild ( StyleSheet styleSheet , VEXElement element ) { } public static void iterateTableRows ( final StyleSheet styleSheet , final VEXElement element , int startOffset , int endOffset , final ElementOrRangeCallback callback ) { } public static void iterateTableCells ( StyleSheet styleSheet , VEXElement element , int startOffset , int endOffset , final ElementOrRangeCallback callback ) { } public static void iterateTableCells ( StyleSheet styleSheet , VEXElement row , final ElementOrRangeCallback callback ) { } public static final Set < String > TABLE_CHILD_STYLES = new HashSet < String > ( ) ; private static final Set < String > NON_ROW_STYLES = new HashSet < String > ( ) ; private static final Set < String > ROW_STYLES = new HashSet < String > ( ) ; private static final Set < String > CELL_STYLES = new HashSet < String > ( ) ; }

Fix:
if ( ! ( nonMatching . isEmpty ( ) ) ) {