#vulnerable code 
                                public void applyStyles( Style style )
    {
        this.lastStyleApplied = style;

        // width
        StyleTableProperties tableProperties = style.getTableProperties();
        if ( tableProperties != null )
        {
            if ( tableProperties.getWidth() != null )
            {
                super.setTotalWidth( tableProperties.getWidth() );
            }
        }

        // alignment
        int alignment = tableProperties.getAlignment();
        if ( alignment != Element.ALIGN_UNDEFINED )
        {
            super.setHorizontalAlignment( alignment );
        }

        // margins
        Float margin = tableProperties.getMargin();
        if ( margin != null && margin > 0.0f )
        {
            super.setPadding( margin );
        }
        Float marginLeft = tableProperties.getMarginLeft();
        if ( marginLeft != null && marginLeft > 0.0f )
        {
            super.setPaddingLeft( marginLeft );
        }
        Float marginRight = tableProperties.getMarginRight();
        if ( marginRight != null && marginRight > 0.0f )
        {
            super.setPaddingRight( marginRight );
        }
        Float marginTop = tableProperties.getMarginTop();
        if ( marginTop != null && marginTop > 0.0f )
        {
            super.setPaddingTop( marginTop );
        }
        Float marginBottom = tableProperties.getMarginBottom();
        if ( marginBottom != null && marginBottom > 0.0f )
        {
            super.setPaddingBottom( marginBottom );
        }
    } 
                            #location 16 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public void applyStyles( Style style )
    {
        this.lastStyleApplied = style;

        StyleTableProperties tableProperties = style.getTableProperties();
        if ( tableProperties != null )
        {
            // width
            if ( tableProperties.getWidth() != null )
            {
                super.setTotalWidth( tableProperties.getWidth() );
            }

            // alignment
            int alignment = tableProperties.getAlignment();
            if ( alignment != Element.ALIGN_UNDEFINED )
            {
                super.setHorizontalAlignment( alignment );
            }

            // margins
            Float margin = tableProperties.getMargin();
            if ( margin != null && margin > 0.0f )
            {
                super.setPadding( margin );
            }
            Float marginLeft = tableProperties.getMarginLeft();
            if ( marginLeft != null && marginLeft > 0.0f )
            {
                super.setPaddingLeft( marginLeft );
            }
            Float marginRight = tableProperties.getMarginRight();
            if ( marginRight != null && marginRight > 0.0f )
            {
                super.setPaddingRight( marginRight );
            }
            Float marginTop = tableProperties.getMarginTop();
            if ( marginTop != null && marginTop > 0.0f )
            {
                super.setPaddingTop( marginTop );
            }
            Float marginBottom = tableProperties.getMarginBottom();
            if ( marginBottom != null && marginBottom > 0.0f )
            {
                super.setPaddingBottom( marginBottom );
            }

            // table splitting
            Boolean mayBreakBetweenRows = tableProperties.getMayBreakBetweenRows();
            if ( mayBreakBetweenRows != null )
            {
                super.setKeepTogether( !mayBreakBetweenRows );
            }
        }
        StyleTableRowProperties tableRowProperties = style.getTableRowProperties();
        if ( tableRowProperties != null )
        {
            // keep together
            Boolean keepTogether = tableRowProperties.getKeepTogether();
            if ( keepTogether != null )
            {
                // keep together is table row property in open office
                // but it is table property in iText
                // so we set keep together = true if any of table rows has this property set to true
                if ( super.isSplitLate() == false && keepTogether == true )
                {
                    super.setSplitLate( true );
                }
            }
        }
    }