From 8a004b81f3c086757c1671d061b2d3cca884b578 Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Mon, 16 Mar 2015 14:45:58 +0000 Subject: [PATCH] logger: Better NULL checking in tpl_log_iter_xml_get_event Currently this function will crash if _tpl_log_store_get_events_for_date() returns a NULL pointer, which it will do if the log files are corrupt (i.e. not valid XML). Errors are already logged when the file is read so there is no need to make any change except that required to avoid a SEGV. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=89595 Signed-off-by: Daniel Thompson --- telepathy-logger/log-iter-xml.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/telepathy-logger/log-iter-xml.c b/telepathy-logger/log-iter-xml.c index 1684a74102de..0ae255018303 100644 --- a/telepathy-logger/log-iter-xml.c +++ b/telepathy-logger/log-iter-xml.c @@ -80,6 +80,8 @@ tpl_log_iter_xml_get_events (TplLogIter *iter, priv->events = _tpl_log_store_get_events_for_date (priv->store, priv->account, priv->target, priv->type_mask, (GDate *) priv->next_date->data); + if (!priv->events) + break; priv->next_event = g_list_last (priv->events); priv->next_date = g_list_previous (priv->next_date); -- 2.1.0