From d282d737921e33bacb3ca81b16270702903fdbed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 29 Sep 2023 08:41:27 +0100 Subject: [PATCH] cid#1537991 Unchecked return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I303817f007dd0035e64d15b3f9310a06aab18060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157396 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- cppuhelper/source/paths.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx index 28a1d34658b3..cf8c748ee7e0 100644 --- a/cppuhelper/source/paths.cxx +++ b/cppuhelper/source/paths.cxx @@ -38,12 +38,11 @@ namespace { OUString get_this_libpath() { static OUString s_uri = []() { OUString uri; - osl::Module::getUrlFromAddress(reinterpret_cast(get_this_libpath), uri); - sal_Int32 i = uri.lastIndexOf('/'); + sal_Int32 i = -1; + if (osl::Module::getUrlFromAddress(reinterpret_cast(get_this_libpath), uri)) + i = uri.lastIndexOf('/'); if (i == -1) - { throw css::uno::DeploymentException("URI " + uri + " is expected to contain a slash"); - } return uri.copy(0, i); }();