summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-11-19 23:54:18 +0100
committerMichael Stahl <mstahl@redhat.com>2014-11-19 23:56:59 +0100
commit6b9ab853b6a5fa71c0b6c594ed0e6e6016d13a3b (patch)
treee087bb9cd9e7469188d08aab193e74ecd99ea303 /sw
parente3e064ed274cc88e5264e102720dc064bde1da6a (diff)
fdo#85872: sw: fix crash in insert index dialog
Looks like the old code would create a link starting at the beginning in this case, so let's do the same. (regression from 94b296d5416dd71d721ad16216b50bce79e3dc04) Change-Id: Idcd17ae51c478aa5c2a000c7b33a8244f06bd166
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/test_ToxLinkProcessor.cxx4
-rw-r--r--sw/source/core/tox/ToxLinkProcessor.cxx11
2 files changed, 10 insertions, 5 deletions
diff --git a/sw/qa/core/test_ToxLinkProcessor.cxx b/sw/qa/core/test_ToxLinkProcessor.cxx
index e0ae1a1bd41e..7c16c18b03a6 100644
--- a/sw/qa/core/test_ToxLinkProcessor.cxx
+++ b/sw/qa/core/test_ToxLinkProcessor.cxx
@@ -64,7 +64,9 @@ ToxLinkProcessorTest::ExceptionIsThrownIfTooManyLinksAreClosed()
ToxLinkProcessor sut;
sut.StartNewLink(0, STYLE_NAME_1);
sut.CloseLink(1, URL_1);
- CPPUNIT_ASSERT_THROW(sut.CloseLink(1, URL_1), std::runtime_error);
+ // fdo#85872 actually it turns out the UI does something like this
+ // so an exception must not be thrown!
+ sut.CloseLink(1, URL_1);
}
void
diff --git a/sw/source/core/tox/ToxLinkProcessor.cxx b/sw/source/core/tox/ToxLinkProcessor.cxx
index 181757c8d0a0..e778f5529596 100644
--- a/sw/source/core/tox/ToxLinkProcessor.cxx
+++ b/sw/source/core/tox/ToxLinkProcessor.cxx
@@ -11,6 +11,7 @@
#include "SwStyleNameMapper.hxx"
#include "ndtxt.hxx"
+#include <poolfmt.hrc>
#include <boost/foreach.hpp>
#include <stdexcept>
@@ -26,11 +27,13 @@ ToxLinkProcessor::StartNewLink(sal_Int32 startPosition, const OUString& characte
void
ToxLinkProcessor::CloseLink(sal_Int32 endPosition, const OUString& url)
{
- if (mStartedLinks.empty()) {
- throw std::runtime_error("ToxLinkProcessor: More calls for CloseLink() than open links exist.");
+ StartedLink const startedLink( (mStartedLinks.empty())
+ ? StartedLink(0, SW_RES(STR_POOLCHR_TOXJUMP))
+ : mStartedLinks.back() );
+ if (!mStartedLinks.empty())
+ {
+ mStartedLinks.pop_back();
}
- StartedLink startedLink = mStartedLinks.back();
- mStartedLinks.pop_back();
if (url.isEmpty()) {
return;