unotools/source/i18n/resmgr.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 04b54d560dd9029e10b026210ecd9105e0368420
Author:     Hossein <hoss...@libreoffice.org>
AuthorDate: Wed Dec 18 23:41:15 2024 +0100
Commit:     David Gilbert <freedesk...@treblig.org>
CommitDate: Wed Dec 25 15:01:25 2024 +0100

    Prevent vcl app crash without translations
    
    Previously, vcl app with gen UI backend was always crashing when no
    translation files where available. This patch fixes that for gen UI
    backend.
    
    This crash happens in minvcl example, when changing one of the LibreOffice
    ui files to a minimal Glade .ui file that contains the used UI elements.
    
    One can run the minweld example with gen ui backend with:
    
    $ export SAL_USE_VCLPLUGIN=gen
    $ ./bin/run minweld
    
    Change-Id: Ia3bf7671577b6b8013cae9b54a5469213bf65601
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178750
    Reviewed-by: David Gilbert <freedesk...@treblig.org>
    Tested-by: Jenkins

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 6d66728f415f..f93e943b628a 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -200,10 +200,12 @@ namespace Translate
         assert(!strchr(sContextAndId.getId(), '') && "should be using nget, 
not get");
 
         //if it's a key id locale, generate it here
-        if (std::use_facet<boost::locale::info>(loc).language() == "qtz")
-        {
-            OString sKeyId(genKeyId(OString::Concat(sContextAndId.mpContext) + 
"|" + std::string_view(sContextAndId.getId())));
-            return OUString::fromUtf8(sKeyId) + u"\u2016" + 
OUString::fromUtf8(sContextAndId.getId());
+        if (std::has_facet<boost::locale::info>(loc)) {
+            if (std::use_facet<boost::locale::info>(loc).language() == "qtz")
+            {
+                OString 
sKeyId(genKeyId(OString::Concat(sContextAndId.mpContext) + "|" + 
std::string_view(sContextAndId.getId())));
+                return OUString::fromUtf8(sKeyId) + u"\u2016" + 
OUString::fromUtf8(sContextAndId.getId());
+            }
         }
 
         //otherwise translate it

Reply via email to