summaryrefslogtreecommitdiff
path: root/fpicker/source/office
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2025-01-13 21:30:28 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2025-01-13 21:12:15 +0100
commit12664b7ceaf1c96943fda3f7e604465b8d34a84c (patch)
treea3407801ddbdbc1bc152ad8bf2dfdaff5349db97 /fpicker/source/office
parenta9bf19d0d399c2aa5356927930335d7ceddf1aea (diff)
tdf#164686: handle exceptions from UCBContentHelper::Exists
When a filename can be treated as a non-file URL, checking its existence may throw. This needs to be handled here. Handles '?' in the filename. Change-Id: If065c483d1a44cbbfcea21f91d72adf1fdfde579 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180199 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'fpicker/source/office')
-rw-r--r--fpicker/source/office/iodlg.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index f1e2132d5c37..cd9a53a0cc88 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -833,7 +833,18 @@ void SvtFileDialog::OpenHdl_Impl(void const * pVoid)
{
case FILEDLG_MODE_SAVE:
{
- if ( ::utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ) )
+ bool exists;
+ try
+ {
+ exists = utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
+ }
+ catch (const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("fpicker.office");
+ ErrorHandler::HandleError(ERRCODE_IO_GENERAL);
+ return;
+ }
+ if (exists)
{
OUString aMsg = FpsResId(STR_SVT_ALREADYEXISTOVERWRITE);
aMsg = aMsg.replaceFirst(