diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-06-30 23:22:10 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-06-30 23:42:28 +0200 |
commit | 2c157249207552e193e52f5ab7fad5b37ae0a748 (patch) | |
tree | 1400e52629b5ad9af6f6dbc2c5cb1b3f93ad10a3 | |
parent | 501ebd0f7c867c4df5ba84fd8b6b1a197aeeea92 (diff) |
fdo#80663: sw: fix crash on Undo of table row/column delete
The _FndBox appears to handle an empty table lines vector, but evidently
it does not check its indexes properly in this case, which crashes with
STL containers.
(regression from bc0c939270a45469b8f22008288b5e4a4d9c9861)
Change-Id: Id864ea12bc97e61c5251f470e446b6b8f69cb054
-rw-r--r-- | sw/source/core/frmedt/tblsel.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index e69b80f7c9df..8aa024e81da6 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -2110,7 +2110,7 @@ void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable ) if( nEndPos < nPos ) nEndPos = nPos; } - if ( nStPos > 1 ) + if (USHRT_MAX != nStPos && nStPos > 1) pLineBefore = rTable.GetTabLines()[nStPos - 2]; if ( nEndPos < rTable.GetTabLines().size() ) pLineBehind = rTable.GetTabLines()[nEndPos]; @@ -2173,7 +2173,8 @@ void _FndBox::DelFrms( SwTable &rTable, bool bAccTableDispose ) nEndPos = rTable.GetTabLines().GetPos( (const SwTableLine*&)pLineBehind ); OSL_ENSURE( nEndPos != USHRT_MAX, "The fox stole the line!" ); - --nEndPos; + if (nEndPos != 0) + --nEndPos; } for ( sal_uInt16 i = nStPos; i <= nEndPos; ++i) |