From d0839c8d108fa625b1d7e3d206692da1e801d4b8 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 21 May 2014 10:53:34 +0200 Subject: [PATCH 8/9] logger: don't assume @error is not NULL https://bugs.freedesktop.org/show_bug.cgi?id=79006 --- telepathy-logger/log-store-sqlite.c | 15 ++++++++------- telepathy-logger/log-store-xml.c | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/telepathy-logger/log-store-sqlite.c b/telepathy-logger/log-store-sqlite.c index 53c1a76..44cf6b2 100644 --- a/telepathy-logger/log-store-sqlite.c +++ b/telepathy-logger/log-store-sqlite.c @@ -534,8 +534,8 @@ out: sqlite3_finalize (sql); /* check that we set an error if appropriate */ - g_assert ((retval == TRUE && *error == NULL) || - (retval == FALSE && *error != NULL)); + g_assert ((retval == TRUE && (error == NULL || *error == NULL)) || + (retval == FALSE && (error == NULL || *error != NULL))); return retval; } @@ -579,8 +579,8 @@ tpl_log_store_sqlite_add_event (TplLogStore *self, out: /* check that we set an error if appropriate */ - g_assert ((retval == TRUE && *error == NULL) || - (retval == FALSE && *error != NULL)); + g_assert ((retval == TRUE && (error == NULL || *error == NULL)) || + (retval == FALSE && (error == NULL || *error != NULL))); DEBUG ("returning with %d", retval); return retval; @@ -746,7 +746,8 @@ out: /* check that we set an error if appropriate * NOTE: retval == NULL && *error != * NULL doesn't apply to this method, since NULL is also for an empty list */ - g_assert ((retval != NULL && *error == NULL) || retval == NULL); + g_assert ((retval != NULL && (error == NULL || *error == NULL)) || + retval == NULL); return retval; } @@ -903,8 +904,8 @@ out: sqlite3_finalize (sql); /* check that we set an error if appropriate */ - g_assert ((retval == TRUE && *error == NULL) || - (retval == FALSE && *error != NULL)); + g_assert ((retval == TRUE && (error == NULL || *error == NULL)) || + (retval == FALSE && (error == NULL || *error != NULL))); return retval; } diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c index 22acfe8..cf81ed9 100644 --- a/telepathy-logger/log-store-xml.c +++ b/telepathy-logger/log-store-xml.c @@ -451,7 +451,8 @@ add_text_event (TplLogStoreXml *self, bus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error); if (bus_connection == NULL) { - DEBUG ("Error acquiring bus connection: %s", (*error)->message); + DEBUG ("Error acquiring bus connection: %s", + error != NULL ? (*error)->message : ""); goto out; } -- 1.9.0