sw/qa/core/test_ToxLinkProcessor.cxx | 4 +++- sw/source/core/tox/ToxLinkProcessor.cxx | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-)
New commits: commit 6b9ab853b6a5fa71c0b6c594ed0e6e6016d13a3b Author: Michael Stahl <mst...@redhat.com> Date: Wed Nov 19 23:54:18 2014 +0100 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 diff --git a/sw/qa/core/test_ToxLinkProcessor.cxx b/sw/qa/core/test_ToxLinkProcessor.cxx index e0ae1a1..7c16c18 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 181757c..e778f55 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits