Kaydet (Commit) f95e7ef3 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

Don't crash when opening templates via WebDAV

When loading a ODT template via HTTP, it crashes LO with an
lang::IllegalArgumentException in LockFileCommon::ResolveLinks.
This happens when closing the loaded template, as LO tries to
remove a not-existing lock. aDocURL at this point is empty, so
HasError() is true.

As stated in the comment, we don't need a lock for documents
created from templates, as this opens an internal copy of the
document, so don't mark the teplate document as locked.

Change-Id: Ide60020b6287aa67861dbcc8ec1b94f37896b7ef
Reviewed-on: https://gerrit.libreoffice.org/42485Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst a7ce8404
...@@ -1005,15 +1005,16 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI ) ...@@ -1005,15 +1005,16 @@ void SfxMedium::LockOrigFileOnDemand( bool bLoading, bool bNoUI )
try try
{ {
bool bResult = pImpl->m_bLocked; bool bResult = pImpl->m_bLocked;
bool bIsTemplate = false;
// so, this is webdav stuff... // so, this is webdav stuff...
if ( !bResult ) if ( !bResult )
{ {
// no read-write access is necessary on loading if the document is explicitly opened as copy // no read-write access is necessary on loading if the document is explicitly opened as copy
const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_TEMPLATE, false); const SfxBoolItem* pTemplateItem = SfxItemSet::GetItem<SfxBoolItem>(GetItemSet(), SID_TEMPLATE, false);
bResult = ( bLoading && pTemplateItem && pTemplateItem->GetValue() ); bIsTemplate = ( bLoading && pTemplateItem && pTemplateItem->GetValue() );
} }
if ( !bResult && !IsReadOnly() ) if ( !bIsTemplate && !bResult && !IsReadOnly() )
{ {
ShowLockResult bUIStatus = ShowLockResult::NoLock; ShowLockResult bUIStatus = ShowLockResult::NoLock;
do do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment