diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-04-20 09:21:42 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-04-20 11:39:51 +0200 |
commit | 76abd1abea8b23e843104756f3942c94e5e81d64 (patch) | |
tree | e3a1ec4e38cd2b2eeaa390eadaaaaf45a075d33f | |
parent | eb4f812b4bc685bdbda7401aaa5add49fd691736 (diff) |
fdo#46074 Ignore corrupted items in Recent Documents
Signed-off-by: Tor Lillqvist <tlillqvist@suse.com>
(cherry picked from commit 488b766836ef41c51670175fc2eeff7c9640e86c)
Signed-off-by: Noel Power <noel.power@novell.com>
Signed-off-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | unotools/source/config/historyoptions.cxx | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx index 73161be7345d..5ba204544e93 100644 --- a/unotools/source/config/historyoptions.cxx +++ b/unotools/source/config/historyoptions.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <cassert> #include <deque> #include <algorithm> @@ -440,20 +441,37 @@ Sequence< Sequence< PropertyValue > > SvtHistoryOptions_Impl::GetList( EHistoryT const sal_Int32 nLength = xOrderList->getElementNames().getLength(); Sequence< Sequence< PropertyValue > > aRet(nLength); + sal_Int32 nCount = 0; for(sal_Int32 nItem=0; nItem<nLength; ++nItem) { - ::rtl::OUString sUrl; - xOrderList->getByName(::rtl::OUString::valueOf(nItem)) >>= xSet; - xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl; - - xItemList->getByName(sUrl) >>= xSet; - seqProperties[s_nOffsetURL ].Value <<= sUrl; - xSet->getPropertyValue(s_sFilter) >>= seqProperties[s_nOffsetFilter ].Value; - xSet->getPropertyValue(s_sTitle) >>= seqProperties[s_nOffsetTitle ].Value; - xSet->getPropertyValue(s_sPassword) >>= seqProperties[s_nOffsetPassword ].Value; - aRet[nItem] = seqProperties; + try + { + ::rtl::OUString sUrl; + xOrderList->getByName(::rtl::OUString::valueOf(nItem)) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl; + + xItemList->getByName(sUrl) >>= xSet; + seqProperties[s_nOffsetURL ].Value <<= sUrl; + xSet->getPropertyValue(s_sFilter) >>= seqProperties[s_nOffsetFilter ].Value; + xSet->getPropertyValue(s_sTitle) >>= seqProperties[s_nOffsetTitle ].Value; + xSet->getPropertyValue(s_sPassword) >>= seqProperties[s_nOffsetPassword ].Value; + aRet[nCount++] = seqProperties; + } + catch(const css::uno::Exception& ex) + { + // <https://bugs.freedesktop.org/show_bug.cgi?id=46074> + // "FILEOPEN: No Recent Documents..." discusses a problem + // with corrupted /org.openoffice.Office/Histories/Histories + // configuration items; to work around that problem, simply + // ignore such corrupted individual items here, so that at + // least newly added items are successfully reported back + // from this function: + LogHelper::logIt(ex); + } } + assert(nCount <= nLength); + aRet.realloc(nCount); seqReturn = aRet; } } |