summaryrefslogtreecommitdiff
path: root/vbahelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-28 10:33:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-29 08:51:48 +0200
commit1ffba0e356608fb6dbf568248e2a953b4d7fb5d6 (patch)
tree5da59640441292421f2137bc85ee7291daed137e /vbahelper
parentce9a41dc387966c74c1af92783a97565b5af3668 (diff)
loplugin:flatten check for throw in then clause
also make the plugin ignore the case where we have var decl's in the clause we want to flatten, which could lead to problematic extension of variable lifetime Change-Id: I3061f7104e8c6a460bf74f5eac325a516ec50c59 Reviewed-on: https://gerrit.libreoffice.org/42889 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vbahelper')
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx9
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx5
2 files changed, 4 insertions, 10 deletions
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 5028d1504b90..5db5cc04cbf7 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -208,13 +208,10 @@ VbaDocumentBase::Unprotect( const uno::Any &aPassword )
uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW );
if( !xProt->isProtected() )
throw uno::RuntimeException("File is already unprotected" );
+ if( aPassword >>= rPassword )
+ xProt->unprotect( rPassword );
else
- {
- if( aPassword >>= rPassword )
- xProt->unprotect( rPassword );
- else
- xProt->unprotect( OUString() );
- }
+ xProt->unprotect( OUString() );
}
void
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index ff0c5f591cba..327986919ab7 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -219,10 +219,7 @@ getCurrentDoc( const OUString& sKey )
throw uno::RuntimeException(
"Can't extract model from basic ( it's obviously not set yet therefore don't know the current document context)" );
}
- else
- {
- SAL_INFO("vbahelper", "Have model points to url " << xModel->getURL());
- }
+ SAL_INFO("vbahelper", "Have model points to url " << xModel->getURL());
}
else
{