summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhyunho <hhstark.kang@samsung.com>2020-10-06 12:22:51 +0900
committerhyunho <hhstark.kang@samsung.com>2020-10-06 12:28:47 +0900
commitc89f708af7a2930c31e513cfb920c3403dd14995 (patch)
tree740eb602b99ff9659eaeb62e1371163f596e69aa /src
parent7c436c0ca677065ed34c99e613e7b8fea019dcad (diff)
downloadlibrua-c89f708af7a2930c31e513cfb920c3403dd14995.tar.gz
librua-c89f708af7a2930c31e513cfb920c3403dd14995.tar.bz2
librua-c89f708af7a2930c31e513cfb920c3403dd14995.zip
Null check for GError
Change-Id: Ie556db6f53f861bb4afb054905d6e9662456e068 Signed-off-by: hyunho <hhstark.kang@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/rua_dbus.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/rua_dbus.c b/src/rua_dbus.c
index aae2c28..e910328 100644
--- a/src/rua_dbus.c
+++ b/src/rua_dbus.c
@@ -66,17 +66,25 @@ int rua_dbus_send_update_signal(update_type type)
RUA_SIGNAL_DATA_UPDATE,
g_variant_new("(i)", type),
&err) == FALSE) {
- LOGE("g_dbus_connection_emit_signal() is failed. %s",
- err->message);
- g_clear_error(&err);
+ if (err != NULL) {
+ LOGE("g_dbus_connection_emit_signal() is failed. %s",
+ err->message);
+ g_clear_error(&err);
+ } else {
+ LOGE("g_dbus_connection_emit_signal() is failed");
+ }
__rua_dbus_exit();
return -1;
}
if (g_dbus_connection_flush_sync(conn, NULL, &err) == FALSE) {
- LOGE("g_dbus_connection_flush_sync() is failed. %s",
- err->message);
- g_clear_error(&err);
+ if (err != NULL) {
+ LOGE("g_dbus_connection_flush_sync() is failed. %s",
+ err->message);
+ g_clear_error(&err);
+ } else {
+ LOGE("g_dbus_connection_emit_signal() is failed");
+ }
__rua_dbus_exit();
return -1;
}
@@ -208,14 +216,20 @@ static void __signal_handler(GDBusConnection *connection,
static void __rua_dbus_init(void)
{
- if (!conn) {
- GError *err = NULL;
- conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
- if (!conn) {
- LOGE("g_bus_get_sync() is failed. %s", err->message);
- g_error_free(err);
- return;
- }
+ GError *err = NULL;
+
+ if (conn)
+ return;
+
+ conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+ if (conn)
+ return;
+
+ if (err != NULL) {
+ LOGE("g_bus_get_sync() is failed. %s", err->message);
+ g_error_free(err);
+ } else {
+ LOGE("g_bus_get_sync() is failed.");
}
}