[Libreoffice-commits] core.git: sw/source

Mike Kaganski mike.kaganski at collabora.com
Tue Dec 19 09:30:22 UTC 2017


 sw/source/core/doc/doclay.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 79827580ce7f6be4ff9017b516dc45c9eba5e01e
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Mon Dec 18 21:08:05 2017 +0200

    Correct the assertion
    
    The anchor node passed to SwDoc::MakeFlySection may be non-content node,
    e.g. a table node when a whole table is selected when inserting a frame.
    Thus assertion must take into account if the bCalledFromShell flag is true.
    
    Change-Id: I947ed9dfc4846a8c4fe430d80fb8286212e0b248
    Reviewed-on: https://gerrit.libreoffice.org/46736
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 8b18199fff7a..3516ff000f80 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -328,7 +328,10 @@ SwFlyFrameFormat* SwDoc::MakeFlySection( RndStdIds eAnchorType,
             (SwNodeIndex( GetNodes().GetEndOfAutotext()),
              getIDocumentStylePoolAccess().GetTextCollFromPool( nCollId ));
         SwContentNode * pAnchorNode = pAnchorPos->nNode.GetNode().GetContentNode();
-        assert(pAnchorNode); // pAnchorNode from cursor, must be valid
+        // pAnchorNode from cursor must be valid, unless a whole table is selected (in which
+        // case the node is not a content node, and pAnchorNode is nullptr). In the latter case,
+        // bCalledFromShell is false.
+        assert(!bCalledFromShell || pAnchorNode);
 
         const SfxPoolItem * pItem = nullptr;
 


More information about the Libreoffice-commits mailing list