summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2014-08-21 10:42:07 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2014-10-06 11:09:04 +0200
commitf6eca82c58ebff172b3a4b8a82a2b3db88696ab1 (patch)
treedd50a2ea192fda2881f52b6467fc2c3953f0cb31
parente9f3f8dbcd6491a284884d3f269f911cc2972203 (diff)
fdo75996 Check search result for bookmark undo
This is quite probably not the correct fix, but it - at least - stops LO from crashing when undoing bookmark changes. Has to be tested to ensure LO actually correctly undoes the bookmark change. Change-Id: Id482943161079cf8a09799da9e67f4f4f4efb7e0
-rw-r--r--sw/source/core/undo/rolbck.cxx20
1 files changed, 13 insertions, 7 deletions
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 016ce12a69cb..6131ee154501 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -615,8 +615,11 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool )
}
else
{
- pMark = pMarkAccess->findMark(m_aName)->get();
- pPam = ::std::auto_ptr<SwPaM>(new SwPaM(pMark->GetMarkPos()));
+ IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(m_aName);
+ if(pMarkAccess->getMarksEnd() != ppMark) {
+ pMark = ppMark->get();
+ pPam = ::std::auto_ptr<SwPaM>(new SwPaM(pMark->GetMarkPos()));
+ }
}
if(m_bSaveOtherPos)
@@ -637,11 +640,14 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool )
{
if(!pMark)
pMark = pMarkAccess->findMark(m_aName)->get();
- OSL_ENSURE(pMark->IsExpanded(),
- "<SwHistoryBookmark::SetInDoc(..)>"
- " - missing pos on old mark");
- pPam->SetMark();
- *pPam->GetMark() = pMark->GetOtherMarkPos();
+ if(pMark)
+ {
+ OSL_ENSURE(pMark->IsExpanded(),
+ "<SwHistoryBookmark::SetInDoc(..)>"
+ " - missing pos on old mark");
+ pPam->SetMark();
+ *pPam->GetMark() = pMark->GetOtherMarkPos();
+ }
}
if(pPam.get())