cui/source/options/optdeepl.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 05e4b5bbe6da465ef6cf1b3a2d0da0a6ed6b825c
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Apr 8 14:30:29 2023 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sat Apr 8 16:35:57 2023 +0200

    tdf#154677: fix crash when clicking on Tools-Options-Language Settings-DeepL
    
    Change-Id: Iaf24dae303edbeeaf8e19a4ca3d19232083a71bb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150158
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx
index 6544a8fbc645..75db4af70f77 100644
--- a/cui/source/options/optdeepl.cxx
+++ b/cui/source/options/optdeepl.cxx
@@ -32,8 +32,15 @@ OptDeeplTabPage::~OptDeeplTabPage() {}
 
 void OptDeeplTabPage::Reset(const SfxItemSet*)
 {
-    
m_xAPIUrl->set_text(*officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get());
-    
m_xAuthKey->set_text(*officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get());
+    std::optional<OUString> oDeeplAPIUrl
+        = officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get();
+    if (oDeeplAPIUrl && !oDeeplAPIUrl->isEmpty())
+        
m_xAPIUrl->set_text(*officecfg::Office::Linguistic::Translation::Deepl::ApiURL::get());
+
+    std::optional<OUString> oDeeplAuthKey
+        = officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get();
+    if (oDeeplAuthKey && !oDeeplAuthKey->isEmpty())
+        
m_xAuthKey->set_text(*officecfg::Office::Linguistic::Translation::Deepl::AuthKey::get());
 }
 
 bool OptDeeplTabPage::FillItemSet(SfxItemSet*)

Reply via email to