[Libreoffice-commits] core.git: vcl/unx

Stephan Bergmann sbergman at redhat.com
Wed Apr 18 06:33:21 UTC 2018


 vcl/unx/gtk3/gtk3gtkinst.cxx |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 200aa825c8905a7f5e636301fc0d3b0c39793e4e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Apr 18 08:28:56 2018 +0200

    Translate::GetReadStringHook() may be null
    
    e.g., during CppunitTest_sc_screenshots
    
    Change-Id: I71bd617df629dab57c73252db0e46ab51eee2a18

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 640f14a3c8ef..f18ea71869de 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4119,26 +4119,32 @@ private:
         if (GTK_IS_BUTTON(pWidget))
         {
             GtkButton* pButton = GTK_BUTTON(pWidget);
-            set_label(pButton, (*m_pStringReplace)(get_label(pButton)));
+            if (m_pStringReplace != nullptr) {
+                set_label(pButton, (*m_pStringReplace)(get_label(pButton)));
+            }
             if (gtk_button_get_use_underline(pButton))
                 m_aMnemonicButtons.push_back(pButton);
         }
         else if (GTK_IS_LABEL(pWidget))
         {
             GtkLabel* pLabel = GTK_LABEL(pWidget);
-            set_label(pLabel, (*m_pStringReplace)(get_label(pLabel)));
+            if (m_pStringReplace != nullptr) {
+                set_label(pLabel, (*m_pStringReplace)(get_label(pLabel)));
+            }
             if (gtk_label_get_use_underline(pLabel))
                 m_aMnemonicLabels.push_back(pLabel);
         }
         else if (GTK_IS_WINDOW(pWidget))
         {
-            GtkWindow* pWindow = GTK_WINDOW(pWidget);
-            set_title(pWindow, (*m_pStringReplace)(get_title(pWindow)));
-            if (GTK_IS_MESSAGE_DIALOG(pWindow))
-            {
-                GtkMessageDialog* pMessageDialog = GTK_MESSAGE_DIALOG(pWindow);
-                set_primary_text(pMessageDialog, (*m_pStringReplace)(get_primary_text(pMessageDialog)));
-                set_secondary_text(pMessageDialog, (*m_pStringReplace)(get_secondary_text(pMessageDialog)));
+            if (m_pStringReplace != nullptr) {
+                GtkWindow* pWindow = GTK_WINDOW(pWidget);
+                set_title(pWindow, (*m_pStringReplace)(get_title(pWindow)));
+                if (GTK_IS_MESSAGE_DIALOG(pWindow))
+                {
+                    GtkMessageDialog* pMessageDialog = GTK_MESSAGE_DIALOG(pWindow);
+                    set_primary_text(pMessageDialog, (*m_pStringReplace)(get_primary_text(pMessageDialog)));
+                    set_secondary_text(pMessageDialog, (*m_pStringReplace)(get_secondary_text(pMessageDialog)));
+                }
             }
         }
     }


More information about the Libreoffice-commits mailing list