summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-06 10:32:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-06 12:50:13 +0100
commite581cc2e5eb943f2cbab43b026cad42a340c8ace (patch)
tree1eddab7e5e2817c8947b22fd54f6b9f1c696b555
parent004cc81168ce4e9f9b2f8fddf3361f8c23323673 (diff)
tdf#121179 FILEOPEN: Crash opening a certain file (gtk/gtk3)
regression from commit 16b2b4f27acb83fc651b8484dead53ebd0e269e1 Simplify containers iterations in sw/source/ui* Change-Id: Id77c41acf1cb891ffa23ca1300633031e367d0d1 Reviewed-on: https://gerrit.libreoffice.org/62935 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/uibase/docvw/frmsidebarwincontainer.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
index 5769386a2b56..f8abc3aa1329 100644
--- a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
+++ b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
@@ -140,11 +140,13 @@ sw::annotation::SwAnnotationWin* SwFrameSidebarWinContainer::get( const SwFrame&
if ( aFrameIter != mpFrameSidebarWinContainer->end() && nIndex >= 0 )
{
SidebarWinContainer& rSidebarWinContainer = (*aFrameIter).second;
- auto aIter = rSidebarWinContainer.begin();
- std::advance(aIter, nIndex);
- pRet = (*aIter).second;
+ if (nIndex < sal_Int32(rSidebarWinContainer.size()))
+ {
+ auto aIter = rSidebarWinContainer.begin();
+ std::advance(aIter, nIndex);
+ pRet = (*aIter).second;
+ }
}
-
return pRet;
}