[Libreoffice-commits] core.git: sw/source
Pierre-Eric Pelloux-Prayer
pierre-eric at lanedo.com
Mon Jun 3 00:30:28 PDT 2013
sw/source/ui/misc/redlndlg.cxx | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 1fadebef054b811d8d6487d45d76dea1990e1268
Author: Pierre-Eric Pelloux-Prayer <pierre-eric at lanedo.com>
Date: Mon May 27 10:45:08 2013 +0200
fdo#57874: verify GetRedlinePos return value before usage
Make sure return value of GetRedlinePos is checked each time
before usage.
Fix crash in Redline dialog.
Change-Id: I5586d8ddc1a7905c524a522addc89969e704048d
diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx
index 7885bb4..5ea478f 100644
--- a/sw/source/ui/misc/redlndlg.cxx
+++ b/sw/source/ui/misc/redlndlg.cxx
@@ -293,10 +293,15 @@ void SwRedlineAcceptDlg::InitAuthors()
SvTreeListEntry* pSelEntry = pTable->FirstSelected();
while (pSelEntry)
{
+ // find the selected redline
+ // (fdo#57874: ignore, if the redline is already gone)
sal_uInt16 nPos = GetRedlinePos(*pSelEntry);
- const SwRedline& rRedln = pSh->GetRedline( nPos );
+ if( nPos != USHRT_MAX )
+ {
+ const SwRedline& rRedln = pSh->GetRedline( nPos );
- bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
+ bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
+ }
pSelEntry = pTable->NextSelected(pSelEntry);
}
@@ -1007,7 +1012,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl)
sal_uInt16 nPos = GetRedlinePos(*pTopEntry);
// disable commenting for protected areas
- if ((pRed = pSh->GotoRedline(nPos, sal_True)) != 0)
+ if (nPos != USHRT_MAX && (pRed = pSh->GotoRedline(nPos, sal_True)) != 0)
{
if( pSh->IsCrsrPtAtEnd() )
pSh->SwapPam();
@@ -1048,6 +1053,10 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl)
pEntry = pTable->GetParent(pEntry);
sal_uInt16 nPos = GetRedlinePos(*pEntry);
+
+ if (nPos == USHRT_MAX)
+ break;
+
const SwRedline &rRedline = pSh->GetRedline(nPos);
More information about the Libreoffice-commits
mailing list