tdf#66141: SwTxtFrm::FormatQuick(bool) endless loop

If a line happens to be invisible (e.g. in too thin cell of a table)
then aLine.FormatLine(nStart) returns nStart, and
aLine.Insert( new SwLineLayout() ) is executed until OOM.

Change-Id: I9b12cf2f1f3f1987cd8ce380b1d85196ffe95e5e
Reviewed-on: https://gerrit.libreoffice.org/15542
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index abec386..7ad55d7 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1918,8 +1918,11 @@ bool SwTxtFrm::FormatQuick( bool bForceQuickFormat )
                      ? GetFollow()->GetOfst() : aInf.GetTxt().getLength();
    do
    {
        nStart = aLine.FormatLine( nStart );
        if( aInf.IsNewLine() || (!aInf.IsStop() && nStart < nEnd) )
        sal_Int32 nShift = aLine.FormatLine(nStart) - nStart;
        nStart += nShift;
        if ((nShift != 0) // Check for special case: line is invisible,
                          // like in too thin table cell: tdf#66141
         && (aInf.IsNewLine() || (!aInf.IsStop() && nStart < nEnd)))
            aLine.Insert( new SwLineLayout() );
    } while( aLine.Next() );