[Xfce4-commits] <xfce4-weather-plugin:master> Add some assertions to parse_weather().

Harald Judt noreply at xfce.org
Sun Dec 9 23:44:20 CET 2012


Updating branch refs/heads/master
         to a822fe9ac482aaabbf362223673fcfd63a68c9bc (commit)
       from dca05f6933f222b668d68edc0e1102eac2172d6e (commit)

commit a822fe9ac482aaabbf362223673fcfd63a68c9bc
Author: Harald Judt <h.judt at gmx.at>
Date:   Sun Dec 9 19:24:35 2012 +0100

    Add some assertions to parse_weather().

 panel-plugin/weather-parsers.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
index 0b1cac5..42dd45f 100644
--- a/panel-plugin/weather-parsers.c
+++ b/panel-plugin/weather-parsers.c
@@ -274,6 +274,7 @@ parse_weather(xmlNode *cur_node,
 {
     xmlNode *child_node;
 
+    g_assert(wd != NULL);
     if (G_UNLIKELY(wd == NULL))
         return;
 
@@ -282,10 +283,11 @@ parse_weather(xmlNode *cur_node,
 
     /* create new timeslices array if it doesn't exist yet, otherwise
        overwrite existing data */
-    if (wd->timeslices == NULL)
+    if (G_UNLIKELY(wd->timeslices == NULL))
         wd->timeslices = g_array_sized_new(FALSE, TRUE,
                                            sizeof(xml_time *), 200);
-    if (wd->timeslices == NULL)
+    g_assert(wd->timeslices != NULL);
+    if (G_UNLIKELY(wd->timeslices == NULL))
         return;
 
     for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next) {


More information about the Xfce4-commits mailing list