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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 21 19:48:54 UTC 2021


 vcl/unx/generic/printer/cpdmgr.cxx |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

New commits:
commit f9317e41621bb446b864ab2be2996f70e07bb61d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Mar 21 15:02:38 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Mar 21 20:48:10 2021 +0100

    cid#1474140 Unchecked return value from library
    
    Change-Id: If04e1e4e582d56432072aebb730d00472939932d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112847
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/generic/printer/cpdmgr.cxx b/vcl/unx/generic/printer/cpdmgr.cxx
index 4f375b9cc416..0a830a7e13c0 100644
--- a/vcl/unx/generic/printer/cpdmgr.cxx
+++ b/vcl/unx/generic/printer/cpdmgr.cxx
@@ -109,24 +109,24 @@ void CPDManager::printerAdded (GDBusConnection *connection,
     proxy = current->getProxy(sender_name);
     if (proxy == nullptr) {
         gchar* contents;
-        GDBusNodeInfo *introspection_data;
 
         // Get Interface for introspection
-        g_file_get_contents ("/usr/share/dbus-1/interfaces/org.openprinting.Backend.xml", &contents, nullptr, nullptr);
-        introspection_data = g_dbus_node_info_new_for_xml (contents, nullptr);
-        proxy = g_dbus_proxy_new_sync (connection,
-                                       G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
-                                       introspection_data->interfaces[0],
-                                       sender_name,
-                                       object_path,
-                                       interface_name,
-                                       nullptr,
-                                       nullptr);
+        if (g_file_get_contents ("/usr/share/dbus-1/interfaces/org.openprinting.Backend.xml", &contents, nullptr, nullptr)) {
+            GDBusNodeInfo *introspection_data = g_dbus_node_info_new_for_xml (contents, nullptr);
+            proxy = g_dbus_proxy_new_sync (connection,
+                                           G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+                                           introspection_data->interfaces[0],
+                                           sender_name,
+                                           object_path,
+                                           interface_name,
+                                           nullptr,
+                                           nullptr);
 
-        g_free(contents);
-        g_dbus_node_info_unref(introspection_data);
-        std::pair<std::string, GDBusProxy *> new_backend (sender_name, proxy);
-        current->addBackend(new_backend);
+            g_free(contents);
+            g_dbus_node_info_unref(introspection_data);
+            std::pair<std::string, GDBusProxy *> new_backend (sender_name, proxy);
+            current->addBackend(new_backend);
+        }
     }
     CPDPrinter *pDest = static_cast<CPDPrinter *>(malloc(sizeof(CPDPrinter)));
     pDest->backend = proxy;


More information about the Libreoffice-commits mailing list