Skip to content

Commit

Permalink
log-iter-xml: Fix crash when logs are corrupted or invalid XML
Browse files Browse the repository at this point in the history
Chances of _tpl_log_store_get_events_for_date returning NULL due to an
invalid XML file are lower because we ask libxml2 (since commit
734af80) to recover from errors if possible. Even then, it doesn't
hurt to defend against this eventuality.

Thanks to Daniel Thompson for catching this!

https://bugs.freedesktop.org/show_bug.cgi?id=89595
  • Loading branch information
debarshiray committed Apr 28, 2015
1 parent 1d35d99 commit 7118429
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion telepathy-logger/log-iter-xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ tpl_log_iter_xml_get_events (TplLogIter *iter,
priv->account, priv->target, priv->type_mask,
(GDate *) priv->next_date->data);

priv->next_event = g_list_last (priv->events);
priv->next_date = g_list_previous (priv->next_date);

if (priv->events == NULL)
continue;

priv->next_event = g_list_last (priv->events);
}

event = TPL_EVENT (priv->next_event->data);
Expand Down

0 comments on commit 7118429

Please sign in to comment.